Struct carapax::types::SetWebhook
source · pub struct SetWebhook { /* private fields */ }
Expand description
Specifies an url and returns incoming updates via an outgoing webhook.
Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts.
If you’d like to make sure that the Webhook request comes from Telegram,
we recommend using a secret path in the URL, e.g. https://www.example.com/<token>
Since nobody else knows your bot‘s token, you can be pretty sure it’s us.
Implementations§
source§impl SetWebhook
impl SetWebhook
sourcepub fn new<T>(url: T) -> SetWebhook
pub fn new<T>(url: T) -> SetWebhook
Creates a new SetWebhook
.
§Arguments
url
- HTTPS url to send updates to; use an empty string to remove webhook integration.
sourcepub fn add_allowed_update(self, value: AllowedUpdate) -> SetWebhook
pub fn add_allowed_update(self, value: AllowedUpdate) -> SetWebhook
sourcepub fn with_allowed_updates(self, value: HashSet<AllowedUpdate>) -> SetWebhook
pub fn with_allowed_updates(self, value: HashSet<AllowedUpdate>) -> SetWebhook
Sets a new list of allowed update types.
§Arguments
value
- List of types you want your bot to receive.
For example, specify [AllowedUpdate::Message]
to only receive updates of these types.
See AllowedUpdate
for a complete list of available update types.
Specify an empty list to receive all updates regardless of type (default).
If not specified, the previous setting will be used.
Please note that this parameter doesn’t affect
updates created before the call to the SetWebhook
,
so unwanted updates may be received for a short period of time.
sourcepub fn with_certificate<T>(self, value: T) -> SetWebhook
pub fn with_certificate<T>(self, value: T) -> SetWebhook
Sets a new certificate.
§Arguments
value
- Public key certificate; so that the root certificate in use can be checked.
sourcepub fn with_drop_pending_updates(self, value: bool) -> SetWebhook
pub fn with_drop_pending_updates(self, value: bool) -> SetWebhook
Sets a new value for the drop_pending_updates
flag.
§Arguments
value
- Indicates whether to drop all pending updates.
sourcepub fn with_ip_address<T>(self, value: T) -> SetWebhook
pub fn with_ip_address<T>(self, value: T) -> SetWebhook
Sets a new IP address.
§Arguments
value
- The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS.
sourcepub fn with_max_connections(self, value: i64) -> SetWebhook
pub fn with_max_connections(self, value: i64) -> SetWebhook
Sets a new number of max connections.
§Arguments
value
- Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery; 1-100; default - 40.
Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.
sourcepub fn with_secret_token<T>(self, value: T) -> SetWebhook
pub fn with_secret_token<T>(self, value: T) -> SetWebhook
Sets a new secret token.
§Arguments
value
- A secret token to be sent in a header.
“X-Telegram-Bot-Api-Secret-Token” in every webhook request; 1-256 characters
Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.
Trait Implementations§
source§impl Clone for SetWebhook
impl Clone for SetWebhook
source§fn clone(&self) -> SetWebhook
fn clone(&self) -> SetWebhook
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SetWebhook
impl Debug for SetWebhook
source§impl Method for SetWebhook
impl Method for SetWebhook
source§impl Serialize for SetWebhook
impl Serialize for SetWebhook
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for SetWebhook
impl RefUnwindSafe for SetWebhook
impl Send for SetWebhook
impl Sync for SetWebhook
impl Unpin for SetWebhook
impl UnwindSafe for SetWebhook
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more