pub struct HttpClient { /* private fields */ }
Expand description
SMS-API HTTP interface client.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(config: HttpConfig, tls: &Option<TLSConfig>) -> HttpResult<Self>
pub fn new(config: HttpConfig, tls: &Option<TLSConfig>) -> HttpResult<Self>
Create a new HTTP client that uses the base_url.
Sourcepub async fn set_friendly_name(
&self,
phone_number: impl Into<String>,
friendly_name: Option<impl Into<String>>,
) -> HttpResult<bool>
pub async fn set_friendly_name( &self, phone_number: impl Into<String>, friendly_name: Option<impl Into<String>>, ) -> HttpResult<bool>
Set/Remove the friendly name for a given phone number.
Sourcepub async fn get_friendly_name(
&self,
phone_number: impl Into<String>,
) -> HttpResult<Option<String>>
pub async fn get_friendly_name( &self, phone_number: impl Into<String>, ) -> HttpResult<Option<String>>
Get the friendly name associated with a given phone number.
Sourcepub async fn get_messages(
&self,
phone_number: impl Into<String>,
pagination: Option<HttpPaginationOptions>,
) -> HttpResult<Vec<SmsStoredMessage>>
pub async fn get_messages( &self, phone_number: impl Into<String>, pagination: Option<HttpPaginationOptions>, ) -> HttpResult<Vec<SmsStoredMessage>>
Get messages sent to and from a given phone number. Pagination options are supported.
Sourcepub async fn get_latest_numbers(
&self,
pagination: Option<HttpPaginationOptions>,
) -> HttpResult<Vec<LatestNumberFriendlyNamePair>>
pub async fn get_latest_numbers( &self, pagination: Option<HttpPaginationOptions>, ) -> HttpResult<Vec<LatestNumberFriendlyNamePair>>
Get the latest phone numbers that have been in contact with the SMS-API. This includes both senders and receivers. Pagination options are supported.
Sourcepub async fn get_delivery_reports(
&self,
message_id: i64,
pagination: Option<HttpPaginationOptions>,
) -> HttpResult<Vec<HttpSmsDeliveryReport>>
pub async fn get_delivery_reports( &self, message_id: i64, pagination: Option<HttpPaginationOptions>, ) -> HttpResult<Vec<HttpSmsDeliveryReport>>
Get received delivery reports for a given message_id (comes from send_sms etc). Pagination options are supported.
Sourcepub async fn send_sms(
&self,
message: &HttpOutgoingSmsMessage,
) -> HttpResult<HttpSmsSendResponse>
pub async fn send_sms( &self, message: &HttpOutgoingSmsMessage, ) -> HttpResult<HttpSmsSendResponse>
Send an SMS message to a target phone_number. The result will contain the message reference (provided from modem) and message id (used internally). This will use the message timeout for the request if one is set.
Sourcepub async fn get_network_status(
&self,
) -> HttpResult<HttpModemNetworkStatusResponse>
pub async fn get_network_status( &self, ) -> HttpResult<HttpModemNetworkStatusResponse>
Get the carrier network status.
Sourcepub async fn get_signal_strength(
&self,
) -> HttpResult<HttpModemSignalStrengthResponse>
pub async fn get_signal_strength( &self, ) -> HttpResult<HttpModemSignalStrengthResponse>
Get the modem signal strength for the connected tower.
Sourcepub async fn get_network_operator(
&self,
) -> HttpResult<HttpModemNetworkOperatorResponse>
pub async fn get_network_operator( &self, ) -> HttpResult<HttpModemNetworkOperatorResponse>
Get the underlying network operator, this is often the same across multiple service providers for a given region. Eg: vodafone.
Sourcepub async fn get_service_provider(&self) -> HttpResult<String>
pub async fn get_service_provider(&self) -> HttpResult<String>
Get the SIM service provider, this is the brand that manages the contract. This matters less than the network operator, as they’re just resellers. Eg: ASDA Mobile.
Sourcepub async fn get_battery_level(
&self,
) -> HttpResult<HttpModemBatteryLevelResponse>
pub async fn get_battery_level( &self, ) -> HttpResult<HttpModemBatteryLevelResponse>
Get the Modem Hat’s battery level, which is used for GNSS warm starts.
Sourcepub async fn get_device_info(&self) -> HttpResult<HttpSmsDeviceInfoData>
pub async fn get_device_info(&self) -> HttpResult<HttpSmsDeviceInfoData>
Get device info summary result. This is a more efficient way to request all device info.
Sourcepub async fn get_phone_number(&self) -> HttpResult<Option<String>>
pub async fn get_phone_number(&self) -> HttpResult<Option<String>>
Get the configured sender SMS number. This should be used primarily for client identification. This is optional, as the API could have left this un-configured without any value set.
Sourcepub async fn get_version(&self) -> HttpResult<String>
pub async fn get_version(&self) -> HttpResult<String>
Get the modem SMS-API version string. This will be a semver format, often with feature names added as a suffix, eg: “0.0.1+sentry”.