Skip to content

Commit a6183a8

Browse files
authored
Merge pull request #7 from infobip-community/add-email
Add email channel, get SMS logs issue fix
2 parents a9f3037 + 47c216c commit a6183a8

File tree

22 files changed

+2882
-152
lines changed

22 files changed

+2882
-152
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ Cargo.lock
1717

1818
/.idea/
1919
/.vscode/
20-
.swap
20+
.swap
21+
22+
.env

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ Please make sure that all tests and linters pass for all changes. You can check
6262
We mostly adhere to the [Rust API Guidelines Checklist](https://rust-lang.github.io/api-guidelines/checklist.html) for style and best practices.
6363
We use `rustfmt` to keep the code well-formatted.
6464

65+
If you made any change that requires updating the readme, please change the lib.rs file, and then generate the README.md file by running the following command:
66+
```bash
67+
cargo readme --no-indent-headings > README.md
68+
```
69+
And make sure to re-add the nice icons when reviewing the commit diff.
70+
6571
### ✅ Step 5: Commit
6672
It is recommended to keep your changes grouped logically within individual commits.
6773
Many contributors find it easier to review changes that are split across multiple commits.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ homepage = "https://www.infobip.com/"
77
license = "MIT OR Apache-2.0"
88
name = "infobip_sdk"
99
repository = "https://github.com/infobip-community/infobip-api-rust-sdk"
10-
version = "0.2.0"
10+
version = "0.3.0"
1111

1212
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1313

1414
[dependencies]
15+
dotenv = "0.15.0"
1516
lazy_static = "1.4"
1617
regex = "1.6"
1718
reqwest = { version = "0.11", features = ["blocking", "json", "multipart"] }
@@ -24,8 +25,10 @@ validator = { version = "0.16", features = ["derive"] }
2425

2526
[dev-dependencies]
2627
httpmock = "0.6"
28+
chrono = "0.4"
2729

2830
[features]
29-
default = ["sms", "whatsapp"]
31+
default = ["sms", "whatsapp", "email"]
3032
sms = []
3133
whatsapp = []
34+
email = []

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,24 @@ models errors. The module structure is divided by communication channel.
1717
## 📡 Supported Channels
1818
- [SMS](https://www.infobip.com/docs/api/channels/sms)
1919
- [WhatsApp](https://www.infobip.com/docs/api/channels/whatsapp)
20+
- [Email](https://www.infobip.com/docs/api/channels/email)
2021

2122
More Channels to be added in the near future!
2223

2324
## 🔐 Authentication
2425
To use the library, you'll need to set up an [Infobip account](https://www.infobip.com/signup).
2526
Then you can use your API Key and custom base URL to call the endpoints. You can use the
2627
`Configuration::from_env_api_key()` method to load the configuration from the environment. To
27-
do that, set the `IB_API_KEY` and `IB_BASE_URL` variables.
28+
do that, set the `IB_API_KEY` and `IB_BASE_URL` variables. Alternatively, you can use the
29+
`Configuration::from_dotenv_api_key()` method to load the configuration from a `.env` file.
2830

2931
## 📦 Installation
3032
To use the library, add the dependency to your projects `Cargo.toml`
3133
```toml
3234
[dependencies]
33-
infobip_sdk = "0.1"
35+
infobip_sdk = "<version>"
3436
```
37+
Replace <version> is the latest (or desired) release of the library. For example `0.2.0`.
3538

3639
## 🚀 Usage
3740
To use the library, import the client and channel-specific models. Then create a client and
@@ -126,7 +129,7 @@ let message = Message {
126129
```
127130

128131
### Model validation
129-
Some models have mandatory fields. Optional fields are wrapped in `Option` pointers. Models also
132+
Some models have mandatory fields. Optional fields are wrapped in `Option` Enums. Models also
130133
have additional checks to make sure that fields have valid values, when possible. Validation
131134
is done automatically when calling an endpoint, or you can call the `.validate()` method of the
132135
model.
@@ -135,7 +138,7 @@ model.
135138
You can speed up compile time by turning only the needed channels as library features.
136139
For example, to only build SMS, add the dependency like this:
137140
```toml
138-
infobip_sdk = { version = "0.1", features = ["sms"] }
141+
infobip_sdk = { version = "0.3", features = ["sms"] }
139142
```
140143
You can see the complete list of features in the Cargo.toml of the project. Feature names
141144
follow channel names.

0 commit comments

Comments
 (0)