Skip to main content

GetUpdates

Struct GetUpdates 

Source
pub struct GetUpdates {
    pub offset: Option<i64>,
    pub limit: Option<u8>,
    pub timeout: Option<i64>,
    pub allowed_updates: Option<Box<[Box<str>]>>,
}
Expand description

Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.

§Documentation

https://core.telegram.org/bots/api#getupdates

§Returns

  • Box<[crate::Either<crate::types::Update,crate::types::UpdateUnparsed>]>

Fields§

§offset: Option<i64>

Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as crate::methods::GetUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten.

§limit: Option<u8>

Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.

§timeout: Option<i64>

Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

§allowed_updates: Option<Box<[Box<str>]>>

A JSON-serialized list of the update types you want your bot to receive. For example, specify message, edited_channel_post, callback_query to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn’t affect updates created before the call to crate::methods::GetUpdates, so unwanted updates may be received for a short period of time.

Implementations§

Source§

impl GetUpdates

Source

pub fn new() -> Self

Creates a new GetUpdates.

§Notes

Use builder methods to set optional fields.

Source

pub fn offset<T: Into<i64>>(self, val: T) -> Self

Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as crate::methods::GetUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten.

Source

pub fn offset_option<T: Into<i64>>(self, val: Option<T>) -> Self

Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as crate::methods::GetUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten.

Source

pub fn limit<T: Into<u8>>(self, val: T) -> Self

Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.

Source

pub fn limit_option<T: Into<u8>>(self, val: Option<T>) -> Self

Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.

Source

pub fn timeout<T: Into<i64>>(self, val: T) -> Self

Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

Source

pub fn timeout_option<T: Into<i64>>(self, val: Option<T>) -> Self

Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

Source

pub fn allowed_updates<TItem: Into<Box<str>>, T: IntoIterator<Item = TItem>>( self, val: T, ) -> Self

A JSON-serialized list of the update types you want your bot to receive. For example, specify message, edited_channel_post, callback_query to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn’t affect updates created before the call to crate::methods::GetUpdates, so unwanted updates may be received for a short period of time.

§Notes

Adds multiple elements.

Source

pub fn allowed_update<T: Into<Box<str>>>(self, val: T) -> Self

A JSON-serialized list of the update types you want your bot to receive. For example, specify message, edited_channel_post, callback_query to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn’t affect updates created before the call to crate::methods::GetUpdates, so unwanted updates may be received for a short period of time.

§Notes

Adds a single element.

Source

pub fn allowed_updates_option<TItem: Into<Box<str>>, T: IntoIterator<Item = TItem>>( self, val: Option<T>, ) -> Self

A JSON-serialized list of the update types you want your bot to receive. For example, specify message, edited_channel_post, callback_query to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn’t affect updates created before the call to crate::methods::GetUpdates, so unwanted updates may be received for a short period of time.

§Notes

Adds multiple elements.

Trait Implementations§

Source§

impl Clone for GetUpdates

Source§

fn clone(&self) -> GetUpdates

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GetUpdates

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GetUpdates

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Serialize for GetUpdates

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TelegramMethod for GetUpdates

Source§

type Method = GetUpdates

This type represents a method to Telegram API with data (params)
Source§

type Return = Box<[Either<Update, UpdateUnparsed>]>

This type represents a response from Telegram API, which is returned by the method
Source§

fn build_request<Client>(self, _bot: &Bot<Client>) -> Request<Self::Method>

This method is called when a request is sent to Telegram API. It’s need for preparing a request to Telegram API.
Source§

fn build_response(content: &str) -> Result<Response<Self::Return>, Error>

This method is called when a response is received from Telegram API. It’s need for parsing a response from Telegram API. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more