Skip to content

Commit

Permalink
Added TLS backend selection features & Default, removed get_/`Get…
Browse files Browse the repository at this point in the history
…` 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]>
  • Loading branch information
virtualritz and ukmadlz authored Apr 19, 2024
1 parent c663c01 commit d07807c
Show file tree
Hide file tree
Showing 21 changed files with 1,092 additions and 1,362 deletions.
45 changes: 23 additions & 22 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,30 @@
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
"language": "en",
"words": [
"DTMF",
"ENROUTE",
"Istarska",
"MULTIPRODUCT",
"Multiproduct",
"Structs",
"Vodnjan",
"aabe",
"áéíø",
"bpgk",
"chrono",
"dtmf",
"DTMF",
"ENROUTE",
"httpmock",
"ibsso",
"ijkl",
"infobip",
"Istarska",
"msisdn",
"Multiproduct",
"MULTIPRODUCT",
"norun",
"reqwest",
"rustc",
"rustls",
"Structs",
"thiserror",
"Vodnjan",
"xihiy",
"yirml",
"áéíø"
"yirml"
],
"flagWords": [],
"patterns": [
Expand Down Expand Up @@ -70,26 +71,26 @@
}
],
"ignoreRegExpList": [
"Markdown links",
"Markdown code blocks",
"HTML Tags",
"Inline code blocks",
"Link contents",
"Snippet references",
"Snippet references 2",
"Markdown code blocks",
"Markdown links",
"Multi-line code blocks",
"HTML Tags"
"Snippet references 2",
"Snippet references"
],
"ignorePaths": [
".cspell.json",
"package.json",
"package-lock.json",
"yarn.lock",
"tsconfig.json",
"node_modules/**",
".eslintrc.js",
".vscode/settings.json",
".gitignore",
".github/workflows",
"Cargo.toml"
".gitignore",
".vscode/settings.json",
"Cargo.toml",
"node_modules/**",
"package-lock.json",
"package.json",
"tsconfig.json",
"yarn.lock"
]
}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk


# Added by cargo

/target
Expand All @@ -19,4 +18,6 @@ Cargo.lock
/.vscode/
.swap

.env
.env

version.txt
51 changes: 35 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,48 @@ homepage = "https://www.infobip.com/"
license = "Apache-2.0 OR MIT"
name = "infobip_sdk"
repository = "https://github.com/infobip-community/infobip-api-rust-sdk"
version = "0.6.0"
version = "0.6.1"
rust-version = "1.63"

[features]
default = ["sms", "whatsapp", "email", "reqwest/default-tls"]
# Adds support for sending email.
email = []
# Adds support for SMS.
sms = []
# Adds support for sending WhatsApp messages.
whatsapp = []
# See https://docs.rs/reqwest/latest/reqwest/#optional-features
## Enables TLS functionality provided by `native-tls`.
native-tls = ["reqwest/native-tls"]
## Enables the `vendored` feature of `native-tls`.
native-tls-vendored = ["reqwest/native-tls-vendored"]
# Enables the `alpn` feature of `native-tls`.
#native-tls-alpn = [ "reqwest/native-tls-alpn" ]
## Enables TLS functionality provided by `rustls`. Equivalent to `rustls-tls-webpki-roots`.
rustls-tls = ["reqwest/rustls-tls"]
## Enables TLS functionality provided by `rustls`, without setting any root certificates. Roots have to be specified manually.
rustls-tls-manual-roots = ["reqwest/rustls-tls-manual-roots"]
## Enables TLS functionality provided by `rustls`, while using root certificates from the `webpki-roots` crate.
rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"]
# Enables TLS functionality provided by `rustls`, while using root certificates from the `rustls-native-certs` crate.
#rustls-tls-native-roots = [ "reqwest/rustls-tls-native-root" ]

[dependencies]
lazy_static = "1.4"
regex = "1.9"
reqwest = { version = "0.11", features = ["blocking", "json", "multipart"] }
serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0"
thiserror = "1.0"
tokio = { version = "1.32", features = ["full"] }
document-features = "0.2"
lazy_static = "1"
regex = "1"
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "multipart"] }
serde = { version = "1", features = ["derive"] }
serde_derive = "1"
serde_json = "1"
thiserror = "1"
tokio = { version = "1.37", features = ["full"] }
validator = { version = "0.16", features = ["derive"] }

[dev-dependencies]
httpmock = "0.7"
chrono = "0.4"
httpmock = "0.7"

[build-dependencies]
rustc_version = "0.4"

[features]
default = ["sms", "whatsapp", "email"]
sms = []
whatsapp = []
email = []
Loading

0 comments on commit d07807c

Please sign in to comment.