Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composable events #34

Open
wants to merge 61 commits into
base: trunk
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
aa20a8b
refactor(ari): extract error to separate crate
gibbz00 Sep 13, 2024
67aaaab
refactor(ari): extract `Event` to separate crate
gibbz00 Sep 13, 2024
1be37d6
feat(ari): temporarily remove `#[instrument]` annotations
gibbz00 Sep 13, 2024
00dcd0a
reactor!(ari): use top module star imports
gibbz00 Sep 13, 2024
991b0ee
reactor(ari): use idiomatic code ordering in `client.rs`
gibbz00 Sep 13, 2024
7dd2e9b
feat(ari): remove tracing events from client builder
gibbz00 Sep 13, 2024
c1cee13
refactor!(ari): encapsulate `Client` fields
gibbz00 Sep 13, 2024
2fb8f3b
feat(ari): use unbounded event channels
gibbz00 Sep 13, 2024
87161d8
feat!(ari): inline websocket channel setup in client
gibbz00 Sep 13, 2024
853fccb
refactor(ari): move `RequestClient` to its own file
gibbz00 Sep 13, 2024
c77b1ba
refactor!(ari): invert ownership if `Channel` requests
gibbz00 Sep 13, 2024
218d52c
refactor!(ari/channel): require `channel_id` only in request calls
gibbz00 Sep 13, 2024
3994668
refactor!(ari/channel): make fields private and supply getters instead
gibbz00 Sep 13, 2024
776aabe
refactor!(ari/channel): initial `serde_qs` integration
gibbz00 Sep 14, 2024
380ad35
refactor!(ari/channel): continued `serde_qs` integration
gibbz00 Sep 14, 2024
b6d70ca
feat!(ari/channel): remove tracing event logging
gibbz00 Sep 14, 2024
a179808
perf(ari/channel): avoid recreating `reqwest::Client` on every request
gibbz00 Sep 14, 2024
ee6c5e2
refactor(ari): add `RequestClient.authorized_delete`
gibbz00 Sep 14, 2024
ae76bfa
refactor(ari): add `RequestClient.authorized_post`
gibbz00 Sep 14, 2024
1b32aca
refactor(ari): add `RequestClient.authorized_post_json_response`
gibbz00 Sep 14, 2024
e4a3eb4
refactor(ari): add `RequestClient.authorized_post_variables`
gibbz00 Sep 14, 2024
794b588
refactor(ari): add `RequestClient.authorized_get`
gibbz00 Sep 14, 2024
8f5860f
refactor!(ari): make `DeviceStateChanged` private in `event` module
gibbz00 Sep 14, 2024
44cad89
refactor!(ari): invert self to `RequestClient` in `playback`
gibbz00 Sep 14, 2024
ae8f77e
refactor!(ari): cleanup and place `RtpStastistics` in `channel` module
gibbz00 Sep 14, 2024
c159aed
refactor!(ari): invert self to `RequestClient` in `bridge`
gibbz00 Sep 14, 2024
ae74c59
feat!(ari): prefix `live_recording_` to live recording requests
gibbz00 Sep 14, 2024
0026f81
feat!(ari): prefix `stored_recording_` to stored recording requests
gibbz00 Sep 14, 2024
eb604be
refactor!(ari): invert self to `RequestClient` in `recording`
gibbz00 Sep 14, 2024
4c55e58
refactor!(ari): cleanup and place `Variable` in `channel` module
gibbz00 Sep 14, 2024
f03df68
feat!(ari): go over struct derives and place them in separate files
gibbz00 Sep 14, 2024
5924b29
refactor(ari): place `channel` handling under `request_client` module
gibbz00 Sep 14, 2024
12459a6
refactor(ari): place `channel` handling under `request_client` module
gibbz00 Sep 14, 2024
d47bc02
refactor(ari): place `bridge` and `channel` handling under `request_c…
gibbz00 Sep 14, 2024
0a269cd
refactor(ari): place `recording` handling under `request_client` module
gibbz00 Sep 14, 2024
2c3dadc
chore(ari): go over `RequestClient` method visibilities
gibbz00 Sep 14, 2024
cd6bf59
perf(ari): memoize API key
gibbz00 Sep 14, 2024
e4576bd
chore(ari): make `AuthorizedRequest` private
gibbz00 Sep 14, 2024
2a26a4f
refactor(ari): prefix bridge client requests with `bridge_`
gibbz00 Sep 14, 2024
81b610f
refactor(ari): prefix channel client requests with `channel_`
gibbz00 Sep 14, 2024
cbd424a
refactor(ari): prefix playback client requests with `playback_`
gibbz00 Sep 14, 2024
ddc3b3d
feat!(ari): go over WebSocket event handling
gibbz00 Sep 14, 2024
a45a38c
feat!(ari): add `ClientError`
gibbz00 Sep 14, 2024
c9995c7
chore!(ari): remove `AriError::Tungstenite`
gibbz00 Sep 14, 2024
844764d
chore!(ari): remove `AriError::Unknown`
gibbz00 Sep 14, 2024
fddd6b1
chore!(ari): remove `AriError::UrlParse`
gibbz00 Sep 14, 2024
336df7c
refactor!(ari): replace `AriError` with `RequestClientError`
gibbz00 Sep 14, 2024
228921e
refactor(ari): remove fully qualified `std::result::Result` usage
gibbz00 Sep 14, 2024
8b2d75c
refactor!(ari): rename `Client` to `Asterisk`
gibbz00 Sep 14, 2024
d04e79f
refactor!(ari): rename `RequestClient` to `AriClient`
gibbz00 Sep 14, 2024
b1d2bd3
chore(ari): go over tokio feature flags
gibbz00 Sep 14, 2024
782ee7c
chore(ari): replace qualified `chrono::Utc` with use
gibbz00 Sep 14, 2024
424992f
chore(ari): remove misleading patch version from `Cargo.toml`
gibbz00 Sep 14, 2024
84a122a
chore: place crates in a `crates` directory
gibbz00 Sep 14, 2024
6e4e72a
chore: consolidate packages attributes to workspace
gibbz00 Sep 14, 2024
e8099b1
chore: use workspace dependencies
gibbz00 Sep 14, 2024
233bc4c
chore: remove common `rs` postfix from crate directory names
gibbz00 Sep 14, 2024
46a5075
feat!: change crate names to improve discovery and identifiability
gibbz00 Sep 14, 2024
f1ed531
refactor: move event types to event module
gibbz00 Sep 14, 2024
588be1e
refactor: compose common event data with an `Event<D>` struct
gibbz00 Sep 14, 2024
8562bc0
feat(ari): add missing `StasisStart.replace_channel` field
gibbz00 Sep 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor!(ari): invert ownership if Channel requests
  • Loading branch information
gibbz00 committed Sep 14, 2024
commit c77b1bac47c5633a6b9c4020f9f36ad50c1f0826
4 changes: 2 additions & 2 deletions arirs/examples/list-channels.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use arirs::{Channel, RequestClient, Result};
use arirs::{RequestClient, Result};
use tracing::debug;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};

@@ -11,7 +11,7 @@ async fn main() -> Result<()> {

let client = RequestClient::default();

for channel in Channel::list(&client).await? {
for channel in client.list().await? {
debug!("Channel ID: {}", channel.id);
}

34 changes: 17 additions & 17 deletions arirs/examples/originate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;

use arirs::{Channel, OriginateParams, RequestClient, Result};
use arirs::{OriginateParams, RequestClient, Result};
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};

const APP_NAME: &str = "ari";
@@ -14,22 +14,22 @@ async fn main() -> Result<()> {

let client = RequestClient::default();

Channel::originate(
&client,
"PJSIP/1000",
OriginateParams::Application {
app: APP_NAME,
app_args: vec![],
},
None,
None,
None,
None,
None,
vec!["alaw,ulaw"],
HashMap::new(),
)
.await?;
client
.originate(
"PJSIP/1000",
OriginateParams::Application {
app: APP_NAME,
app_args: vec![],
},
None,
None,
None,
None,
None,
vec!["alaw,ulaw"],
HashMap::new(),
)
.await?;

Ok(())
}
4 changes: 2 additions & 2 deletions arirs/examples/playback.rs
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
while let Some(event) = event_listener.recv().await {
if let Event::StasisStart(e) = event {
let channel = e.channel;
channel
.play_media(&request_client, "sound:hello", Some("en"), None, None, None)
request_client
.play_media(&channel, "sound:hello", Some("en"), None, None, None)
.await?;
}
}
Loading