Skip to content

Commit

Permalink
refactor: renamed TransportType -> ApiInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghamza-Jd committed Sep 20, 2024
1 parent b329399 commit b9cd3e3
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions jarust/examples/raw_echotest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jarust::jaconfig::ApiInterface;
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::jaconnection::CreateConnectionParams;
use jarust::japlugin::Attach;
use jarust::japlugin::AttachHandleParams;
Expand All @@ -20,7 +20,7 @@ async fn main() -> anyhow::Result<()> {
.build();
let mut connection = jarust::connect(
config,
TransportType::Ws,
ApiInterface::WebSocket,
TransactionGenerationStrategy::Random,
)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions jarust/examples/restful.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jarust::jaconfig::ApiInterface;
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::jaconnection::CreateConnectionParams;
use jarust::japlugin::Attach;
use jarust::japlugin::AttachHandleParams;
Expand Down Expand Up @@ -28,7 +28,7 @@ async fn main() -> anyhow::Result<()> {
.build();
let mut connection = jarust::connect(
config,
TransportType::Http,
ApiInterface::Restful,
TransactionGenerationStrategy::Random,
)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions jarust/examples/secure_ws.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jarust::jaconfig::ApiInterface;
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::jaconnection::CreateConnectionParams;
use jarust::japlugin::Attach;
use jarust::japlugin::AttachHandleParams;
Expand Down Expand Up @@ -28,7 +28,7 @@ async fn main() -> anyhow::Result<()> {
.build();
let mut connection = jarust::connect(
config,
TransportType::Ws,
ApiInterface::WebSocket,
TransactionGenerationStrategy::Random,
)
.await?;
Expand Down
6 changes: 3 additions & 3 deletions jarust/src/jaconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pub struct JaConfig {
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum TransportType {
Ws,
Http,
pub enum ApiInterface {
WebSocket,
Restful,
}

impl JaConfig {
Expand Down
10 changes: 5 additions & 5 deletions jarust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub mod prelude;
pub use jarust_transport::transaction_gen::GenerateTransaction;
pub use jarust_transport::transaction_gen::TransactionGenerationStrategy;

use jaconfig::ApiInterface;
use jaconfig::JaConfig;
use jaconfig::TransportType;
use jaconnection::JaConnection;
use jarust_transport::interface::janus_interface::ConnectionParams;
use jarust_transport::interface::janus_interface::JanusInterface;
Expand All @@ -35,7 +35,7 @@ use tracing::Level;
#[cfg(not(target_family = "wasm"))]
pub async fn connect(
jaconfig: JaConfig,
transport_type: TransportType,
transport_type: ApiInterface,
transaction_generation_strategy: TransactionGenerationStrategy,
) -> JaResult<JaConnection> {
let conn_params = ConnectionParams {
Expand All @@ -46,13 +46,13 @@ pub async fn connect(
};
let transaction_generator = transaction_generation_strategy.generator();
match transport_type {
TransportType::Ws => {
ApiInterface::WebSocket => {
custom_connect(
WebSocketInterface::make_interface(conn_params, transaction_generator).await?,
)
.await
}
TransportType::Http => {
ApiInterface::Restful => {
custom_connect(
RestfulInterface::make_interface(conn_params, transaction_generator).await?,
)
Expand All @@ -65,7 +65,7 @@ pub async fn connect(
#[cfg(target_family = "wasm")]
pub async fn connect(
jaconfig: JaConfig,
transport_type: TransportType,
transport_type: ApiInterface,
transaction_generation_strategy: TransactionGenerationStrategy,
) -> JaResult<JaConnection> {
todo!("WASM is not supported yet")
Expand Down
4 changes: 2 additions & 2 deletions jarust_plugins/examples/audio_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::jaconfig::ApiInterface;
use jarust::jaconnection::CreateConnectionParams;
use jarust::TransactionGenerationStrategy;
use jarust_plugins::audio_bridge::jahandle_ext::AudioBridge;
Expand All @@ -25,7 +25,7 @@ async fn main() -> anyhow::Result<()> {
.build();
let mut connection = jarust::connect(
config,
TransportType::Ws,
ApiInterface::WebSocket,
TransactionGenerationStrategy::Random,
)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions jarust_plugins/examples/echotest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::jaconfig::ApiInterface;
use jarust::jaconnection::CreateConnectionParams;
use jarust::TransactionGenerationStrategy;
use jarust_plugins::echo_test::events::EchoTestEvent;
Expand All @@ -26,7 +26,7 @@ async fn main() -> anyhow::Result<()> {
.build();
let mut connection = jarust::connect(
config,
TransportType::Ws,
ApiInterface::WebSocket,
TransactionGenerationStrategy::Random,
)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions jarust_plugins/examples/echotest_start_with_establishment.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::jaconfig::ApiInterface;
use jarust::jaconnection::CreateConnectionParams;
use jarust::TransactionGenerationStrategy;
use jarust_plugins::echo_test::events::EchoTestEvent;
Expand Down Expand Up @@ -29,7 +29,7 @@ async fn main() -> anyhow::Result<()> {
.build();
let mut connection = jarust::connect(
config,
TransportType::Ws,
ApiInterface::WebSocket,
TransactionGenerationStrategy::Random,
)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions jarust_plugins/examples/video_room.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jarust::jaconfig::ApiInterface;
use jarust::jaconfig::JaConfig;
use jarust::jaconfig::TransportType;
use jarust::jaconnection::CreateConnectionParams;
use jarust::TransactionGenerationStrategy;
use jarust_plugins::video_room::jahandle_ext::VideoRoom;
Expand Down Expand Up @@ -27,7 +27,7 @@ async fn main() -> anyhow::Result<()> {
.build();
let mut connection = jarust::connect(
config,
TransportType::Ws,
ApiInterface::WebSocket,
TransactionGenerationStrategy::Random,
)
.await?;
Expand Down

0 comments on commit b9cd3e3

Please sign in to comment.