Struct webex::Webex

source ·
pub struct Webex {
    pub device: DeviceData,
    /* private fields */
}
Expand description

Webex API Client

Fields§

§device: DeviceData

Webex Device Information used for device registration

Implementations§

source§

impl Webex

source

pub async fn new(token: &str) -> Self

Constructs a new Webex Teams context from a token Tokens can be obtained when creating a bot, see https://developer.webex.com/my-apps for more information and to create your own Webex bots.

source

pub async fn new_with_device_name(device_name: &str, token: &str) -> Self

Constructs a new Webex Teams context from a token and a chosen name The name is used to identify the device/client with Webex api

source

pub async fn event_stream(&self) -> Result<WebexEventStream, Error>

Get an event stream handle

source

pub async fn get_orgs(&self) -> Result<Vec<Organization>, Error>

👎Deprecated since 0.6.3: Please use webex::list::<Organization>() instead

Get list of organizations

source

pub async fn get_attachment_action( &self, id: &GlobalId ) -> Result<AttachmentAction, Error>

👎Deprecated since 0.6.3: Please use webex::get::<AttachmentAction>(id) instead

Get attachment action Retrieves the attachment for the given ID. This can be used to retrieve data from an AdaptiveCard submission

source

pub async fn get_message(&self, id: &GlobalId) -> Result<Message, Error>

👎Deprecated since 0.6.3: Please use webex::get::<Message>(id) instead

Get a message by ID

source

pub async fn delete_message(&self, id: &GlobalId) -> Result<(), Error>

👎Deprecated since 0.6.3: Please use webex::delete::<Message>(id) instead

Delete a message by ID

source

pub async fn get_rooms(&self) -> Result<Vec<Room>, Error>

👎Deprecated since 0.6.3: Please use webex::list::<Room>() instead

Get available rooms

source

pub async fn get_all_rooms(&self) -> Result<Vec<Room>, Error>

Get all rooms from all organizations that the client belongs to. Will be slow as does multiple API calls (one to get teamless rooms, one to get teams, then one per team).

source

pub async fn get_room(&self, id: &GlobalId) -> Result<Room, Error>

👎Deprecated since 0.6.3: Please use webex::get::<Room>(id) instead

Get available room

source

pub async fn get_person(&self, id: &GlobalId) -> Result<Person, Error>

👎Deprecated since 0.6.3: Please use webex::get::<Person>(id) instead

Get information about person

source

pub async fn send_message(&self, message: &MessageOut) -> Result<Message, Error>

Send a message to a user or room

Arguments
  • message: MessageOut - the message to send, including one of room_id, to_person_id or to_person_email.
Errors

Types of errors returned:

source

pub async fn edit_message( &self, message_id: &GlobalId, params: &MessageEditParams<'_> ) -> Result<Message, Error>

Edit an existing message

Arguments
  • params: MessageEditParams - the message to edit, including the message ID and the room ID, as well as the new message text.
Errors

Types of errors returned:

  • ErrorKind::Limited - returned on HTTP 423/429 with an optional Retry-After.
  • ErrorKind::Status | ErrorKind::StatusText - returned when the request results in a non-200 code.
  • ErrorKind::Json - returned when your input object cannot be serialized, or the return value cannot be deserialised. (If this happens, this is a library bug and should be reported).
source

pub async fn get<T: Gettable + DeserializeOwned>( &self, id: &GlobalId ) -> Result<T, Error>

Get a resource from an ID

Errors
source

pub async fn delete<T: Gettable + DeserializeOwned>( &self, id: &GlobalId ) -> Result<(), Error>

Delete a resource from an ID

source

pub async fn list<T: Gettable + DeserializeOwned>( &self ) -> Result<Vec<T>, Error>

List resources of a type

source

pub async fn list_with_params<T: Gettable + DeserializeOwned>( &self, list_params: T::ListParams<'_> ) -> Result<Vec<T>, Error>

List resources of a type, with parameters

Trait Implementations§

source§

impl Clone for Webex

source§

fn clone(&self) -> Webex

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Webex

§

impl Send for Webex

§

impl Sync for Webex

§

impl Unpin for Webex

§

impl !UnwindSafe for Webex

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<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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