Skip to content

Commit d07807c

Browse files
virtualritzMike Elsmore
andauthored
Added TLS backend selection features & Default, removed get_/Get prefixes (#25)
* Added `Default` to `model::sms::Message`, adjusted docs & README accordingly, fixed line breaks (proper markdown) and headline capitalization in README. * Fixed broken user agent string builder. * Bumped dependencies, docs. * Fixed docs, added feature flags for selecting TLS implementation, masked out code not used for some features. * rustfmt and spelling in docs. * Fixed failing doctests. * * Added `Default` trait everywhere. * Simplified `new()` where possible. * Renamed `enum` variants to `PascalCase` (Rust naming guidelines). * Removed `get_` prefix from all getters/everywhere (Rust naming guidelines). * Simplified some places. * rustfmt. * Made clippy happy. * Renamed `WhatsappClient` to `WhatsAppClient`. * Bumped deps. * Removed `Get` prefix from struct names as it was related to `get_` prefixed methods which have since been renamed." * Added 'rustls' to and sorted .cspell.json. --------- Co-authored-by: Mike Elsmore <[email protected]>
1 parent c663c01 commit d07807c

File tree

21 files changed

+1092
-1362
lines changed

21 files changed

+1092
-1362
lines changed

.cspell.json

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,30 @@
33
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
44
"language": "en",
55
"words": [
6-
"DTMF",
7-
"ENROUTE",
8-
"Istarska",
9-
"MULTIPRODUCT",
10-
"Multiproduct",
11-
"Structs",
12-
"Vodnjan",
136
"aabe",
7+
"áéíø",
148
"bpgk",
159
"chrono",
1610
"dtmf",
11+
"DTMF",
12+
"ENROUTE",
1713
"httpmock",
1814
"ibsso",
1915
"ijkl",
2016
"infobip",
17+
"Istarska",
2118
"msisdn",
19+
"Multiproduct",
20+
"MULTIPRODUCT",
2221
"norun",
2322
"reqwest",
2423
"rustc",
24+
"rustls",
25+
"Structs",
2526
"thiserror",
27+
"Vodnjan",
2628
"xihiy",
27-
"yirml",
28-
"áéíø"
29+
"yirml"
2930
],
3031
"flagWords": [],
3132
"patterns": [
@@ -70,26 +71,26 @@
7071
}
7172
],
7273
"ignoreRegExpList": [
73-
"Markdown links",
74-
"Markdown code blocks",
74+
"HTML Tags",
7575
"Inline code blocks",
7676
"Link contents",
77-
"Snippet references",
78-
"Snippet references 2",
77+
"Markdown code blocks",
78+
"Markdown links",
7979
"Multi-line code blocks",
80-
"HTML Tags"
80+
"Snippet references 2",
81+
"Snippet references"
8182
],
8283
"ignorePaths": [
8384
".cspell.json",
84-
"package.json",
85-
"package-lock.json",
86-
"yarn.lock",
87-
"tsconfig.json",
88-
"node_modules/**",
8985
".eslintrc.js",
90-
".vscode/settings.json",
91-
".gitignore",
9286
".github/workflows",
93-
"Cargo.toml"
87+
".gitignore",
88+
".vscode/settings.json",
89+
"Cargo.toml",
90+
"node_modules/**",
91+
"package-lock.json",
92+
"package.json",
93+
"tsconfig.json",
94+
"yarn.lock"
9495
]
9596
}

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Cargo.lock
99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
1111

12-
1312
# Added by cargo
1413

1514
/target
@@ -19,4 +18,6 @@ Cargo.lock
1918
/.vscode/
2019
.swap
2120

22-
.env
21+
.env
22+
23+
version.txt

Cargo.toml

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,48 @@ homepage = "https://www.infobip.com/"
77
license = "Apache-2.0 OR MIT"
88
name = "infobip_sdk"
99
repository = "https://github.com/infobip-community/infobip-api-rust-sdk"
10-
version = "0.6.0"
10+
version = "0.6.1"
1111
rust-version = "1.63"
1212

13+
[features]
14+
default = ["sms", "whatsapp", "email", "reqwest/default-tls"]
15+
# Adds support for sending email.
16+
email = []
17+
# Adds support for SMS.
18+
sms = []
19+
# Adds support for sending WhatsApp messages.
20+
whatsapp = []
21+
# See https://docs.rs/reqwest/latest/reqwest/#optional-features
22+
## Enables TLS functionality provided by `native-tls`.
23+
native-tls = ["reqwest/native-tls"]
24+
## Enables the `vendored` feature of `native-tls`.
25+
native-tls-vendored = ["reqwest/native-tls-vendored"]
26+
# Enables the `alpn` feature of `native-tls`.
27+
#native-tls-alpn = [ "reqwest/native-tls-alpn" ]
28+
## Enables TLS functionality provided by `rustls`. Equivalent to `rustls-tls-webpki-roots`.
29+
rustls-tls = ["reqwest/rustls-tls"]
30+
## Enables TLS functionality provided by `rustls`, without setting any root certificates. Roots have to be specified manually.
31+
rustls-tls-manual-roots = ["reqwest/rustls-tls-manual-roots"]
32+
## Enables TLS functionality provided by `rustls`, while using root certificates from the `webpki-roots` crate.
33+
rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"]
34+
# Enables TLS functionality provided by `rustls`, while using root certificates from the `rustls-native-certs` crate.
35+
#rustls-tls-native-roots = [ "reqwest/rustls-tls-native-root" ]
36+
1337
[dependencies]
14-
lazy_static = "1.4"
15-
regex = "1.9"
16-
reqwest = { version = "0.11", features = ["blocking", "json", "multipart"] }
17-
serde = { version = "1.0", features = ["derive"] }
18-
serde_derive = "1.0"
19-
serde_json = "1.0"
20-
thiserror = "1.0"
21-
tokio = { version = "1.32", features = ["full"] }
38+
document-features = "0.2"
39+
lazy_static = "1"
40+
regex = "1"
41+
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "multipart"] }
42+
serde = { version = "1", features = ["derive"] }
43+
serde_derive = "1"
44+
serde_json = "1"
45+
thiserror = "1"
46+
tokio = { version = "1.37", features = ["full"] }
2247
validator = { version = "0.16", features = ["derive"] }
2348

2449
[dev-dependencies]
25-
httpmock = "0.7"
2650
chrono = "0.4"
51+
httpmock = "0.7"
2752

2853
[build-dependencies]
2954
rustc_version = "0.4"
30-
31-
[features]
32-
default = ["sms", "whatsapp", "email"]
33-
sms = []
34-
whatsapp = []
35-
email = []

0 commit comments

Comments
 (0)