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
impl Webex
sourcepub async fn new(token: &str) -> Self
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.
sourcepub async fn new_with_device_name(device_name: &str, token: &str) -> Self
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
sourcepub async fn event_stream(&self) -> Result<WebexEventStream, Error>
pub async fn event_stream(&self) -> Result<WebexEventStream, Error>
Get an event stream handle
sourcepub async fn get_orgs(&self) -> Result<Vec<Organization>, Error>
👎Deprecated since 0.6.3: Please use webex::list::<Organization>()
instead
pub async fn get_orgs(&self) -> Result<Vec<Organization>, Error>
webex::list::<Organization>()
insteadGet list of organizations
sourcepub async fn get_attachment_action(
&self,
id: &GlobalId
) -> Result<AttachmentAction, Error>
👎Deprecated since 0.6.3: Please use webex::get::<AttachmentAction>(id)
instead
pub async fn get_attachment_action( &self, id: &GlobalId ) -> Result<AttachmentAction, Error>
webex::get::<AttachmentAction>(id)
insteadGet attachment action
Retrieves the attachment for the given ID. This can be used to
retrieve data from an AdaptiveCard
submission
sourcepub async fn get_message(&self, id: &GlobalId) -> Result<Message, Error>
👎Deprecated since 0.6.3: Please use webex::get::<Message>(id)
instead
pub async fn get_message(&self, id: &GlobalId) -> Result<Message, Error>
webex::get::<Message>(id)
insteadGet a message by ID
sourcepub async fn delete_message(&self, id: &GlobalId) -> Result<(), Error>
👎Deprecated since 0.6.3: Please use webex::delete::<Message>(id)
instead
pub async fn delete_message(&self, id: &GlobalId) -> Result<(), Error>
webex::delete::<Message>(id)
insteadDelete a message by ID
sourcepub async fn get_rooms(&self) -> Result<Vec<Room>, Error>
👎Deprecated since 0.6.3: Please use webex::list::<Room>()
instead
pub async fn get_rooms(&self) -> Result<Vec<Room>, Error>
webex::list::<Room>()
insteadGet available rooms
sourcepub async fn get_all_rooms(&self) -> Result<Vec<Room>, Error>
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).
sourcepub async fn get_room(&self, id: &GlobalId) -> Result<Room, Error>
👎Deprecated since 0.6.3: Please use webex::get::<Room>(id)
instead
pub async fn get_room(&self, id: &GlobalId) -> Result<Room, Error>
webex::get::<Room>(id)
insteadGet available room
sourcepub async fn get_person(&self, id: &GlobalId) -> Result<Person, Error>
👎Deprecated since 0.6.3: Please use webex::get::<Person>(id)
instead
pub async fn get_person(&self, id: &GlobalId) -> Result<Person, Error>
webex::get::<Person>(id)
insteadGet information about person
sourcepub async fn send_message(&self, message: &MessageOut) -> Result<Message, Error>
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 ofroom_id
,to_person_id
orto_person_email
.
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.)ErrorKind::UTF8
- returned when the request returns non-UTF8 code.
sourcepub async fn edit_message(
&self,
message_id: &GlobalId,
params: &MessageEditParams<'_>
) -> Result<Message, Error>
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).
sourcepub async fn get<T: Gettable + DeserializeOwned>(
&self,
id: &GlobalId
) -> Result<T, Error>
pub async fn get<T: Gettable + DeserializeOwned>( &self, id: &GlobalId ) -> Result<T, Error>
Get a resource from an ID
Errors
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.)ErrorKind::UTF8
- returned when the request returns non-UTF8 code.
sourcepub async fn delete<T: Gettable + DeserializeOwned>(
&self,
id: &GlobalId
) -> Result<(), Error>
pub async fn delete<T: Gettable + DeserializeOwned>( &self, id: &GlobalId ) -> Result<(), Error>
Delete a resource from an ID
sourcepub async fn list<T: Gettable + DeserializeOwned>(
&self
) -> Result<Vec<T>, Error>
pub async fn list<T: Gettable + DeserializeOwned>( &self ) -> Result<Vec<T>, Error>
List resources of a type
sourcepub async fn list_with_params<T: Gettable + DeserializeOwned>(
&self,
list_params: T::ListParams<'_>
) -> Result<Vec<T>, Error>
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