pub struct Http {
pub authority: String,
pub rest_address: String,
pub rest_address_versionless: String,
pub headers: HeaderMap,
pub request_client: Arc<Client<HttpsConnector<HttpConnector>, Full<Bytes>>>,
}
Fields§
§rest_address: String
§rest_address_versionless: String
§headers: HeaderMap
§request_client: Arc<Client<HttpsConnector<HttpConnector>, Full<Bytes>>>
Implementations§
Source§impl Http
impl Http
Sourcepub async fn request<R: DeserializeOwned, T: Serialize + ?Sized, U>(
&self,
method: Method,
uri: U,
data: Option<&T>,
) -> LavalinkResult<R>
pub async fn request<R: DeserializeOwned, T: Serialize + ?Sized, U>( &self, method: Method, uri: U, data: Option<&T>, ) -> LavalinkResult<R>
Makes an HTTP/1.1 request using Hyper to endpoints that return deserializable data.
Sourcepub async fn raw_request<T: Serialize + ?Sized, U>(
&self,
method: Method,
uri: U,
data: Option<&T>,
) -> LavalinkResult<String>
pub async fn raw_request<T: Serialize + ?Sized, U>( &self, method: Method, uri: U, data: Option<&T>, ) -> LavalinkResult<String>
Makes an HTTP/1.1 request using Hyper to endpoints that return text data.
Sourcepub fn path_to_uri(
&self,
path: &str,
with_version: bool,
) -> Result<Uri, InvalidUri>
pub fn path_to_uri( &self, path: &str, with_version: bool, ) -> Result<Uri, InvalidUri>
Convert a path and query to a uri that points to the lavalink server.
Sourcepub async fn delete_player(
&self,
guild_id: impl Into<GuildId>,
session_id: &str,
) -> LavalinkResult<()>
pub async fn delete_player( &self, guild_id: impl Into<GuildId>, session_id: &str, ) -> LavalinkResult<()>
Destroys the player for this guild in this session.
Sourcepub async fn update_player(
&self,
guild_id: impl Into<GuildId>,
session_id: &str,
data: &UpdatePlayer,
no_replace: bool,
) -> LavalinkResult<Player>
pub async fn update_player( &self, guild_id: impl Into<GuildId>, session_id: &str, data: &UpdatePlayer, no_replace: bool, ) -> LavalinkResult<Player>
Updates or creates the player for this guild.
Sourcepub async fn set_resuming_state(
&self,
session_id: &str,
resuming_state: &ResumingState,
) -> LavalinkResult<ResumingState>
pub async fn set_resuming_state( &self, session_id: &str, resuming_state: &ResumingState, ) -> LavalinkResult<ResumingState>
Updates the session with the resuming state and timeout.
Sourcepub async fn load_tracks(&self, identifier: &str) -> LavalinkResult<Track>
pub async fn load_tracks(&self, identifier: &str) -> LavalinkResult<Track>
Resolves audio tracks for use with the update_player
endpoint.
§Parameters
identifier
: A track identifier.- Can be a url: “https://youtu.be/watch?v=DrM2lo6B04I”
- A unique identifier: “DrM2lo6B04I”
- A search: “ytsearch:Ne Obliviscaris - Forget Not”
Sourcepub async fn version(&self) -> LavalinkResult<String>
pub async fn version(&self) -> LavalinkResult<String>
Request Lavalink server version.
Sourcepub async fn stats(&self) -> LavalinkResult<Stats>
pub async fn stats(&self) -> LavalinkResult<Stats>
Request Lavalink statistics.
NOTE: The frame stats will never be returned.
Sourcepub async fn info(&self) -> LavalinkResult<Info>
pub async fn info(&self) -> LavalinkResult<Info>
Request Lavalink server information.
Sourcepub async fn decode_track(&self, track: &str) -> LavalinkResult<TrackData>
pub async fn decode_track(&self, track: &str) -> LavalinkResult<TrackData>
Sourcepub async fn decode_tracks(
&self,
tracks: &[String],
) -> LavalinkResult<Vec<TrackData>>
pub async fn decode_tracks( &self, tracks: &[String], ) -> LavalinkResult<Vec<TrackData>>
Sourcepub async fn get_player(
&self,
guild_id: impl Into<GuildId>,
session_id: &str,
) -> LavalinkResult<Player>
pub async fn get_player( &self, guild_id: impl Into<GuildId>, session_id: &str, ) -> LavalinkResult<Player>
Returns the player for this guild in this session.
Sourcepub async fn get_players(&self, session_id: &str) -> LavalinkResult<Vec<Player>>
pub async fn get_players(&self, session_id: &str) -> LavalinkResult<Vec<Player>>
Returns a list of players in this specific session.
Trait Implementations§
Source§impl PyClassImpl for Http
impl PyClassImpl for Http
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
Source§type ThreadChecker = SendablePyClass<Http>
type ThreadChecker = SendablePyClass<Http>
This handles following two situations: Read more
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyTypeInfo for Http
impl PyTypeInfo for Http
Source§type AsRefTarget = PyCell<Http>
type AsRefTarget = PyCell<Http>
Utility type to make Py::as_ref work.
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
Source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Returns the safe abstraction over the type object.
Source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
Checks if
object
is an instance of this type or a subclass of this type.Source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
Checks if
object
is an instance of this type.Auto Trait Implementations§
impl Freeze for Http
impl !RefUnwindSafe for Http
impl Send for Http
impl Sync for Http
impl Unpin for Http
impl !UnwindSafe for Http
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
Mutably borrows from an owned value. Read more