Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"
package.version = "0.10.0"

[workspace.dependencies]
beam-lib = { path = "./beam-lib", features = [ "strict-ids" ] }
beam-lib = { path = "./beam-lib" }
# Command Line Interface
clap = { version = "4", features = ["env", "derive"] }

Expand Down
1 change: 0 additions & 1 deletion beam-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ reqwest = { version = "0.12", features = ["json"], default-features = false, opt
thiserror = { version = "2.0", optional = true }

[features]
strict-ids = []
http-util = ["dep:reqwest", "dep:thiserror"]
sockets = []
8 changes: 4 additions & 4 deletions beam-lib/src/http_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use reqwest::{Client, header::{self, HeaderValue, HeaderName}, Url, StatusCode,
use serde::{de::DeserializeOwned, Serialize};
use thiserror::Error;

use crate::{AddressingId, TaskRequest, MsgId, TaskResult, ProxyId};
use crate::{AppId, MsgId, ProxyId, TaskRequest, TaskResult};
#[cfg(feature = "sockets")]
use crate::SocketTask;

Expand Down Expand Up @@ -71,7 +71,7 @@ impl BlockingOptions {

impl BeamClient {
/// Create a beam client based on the Authorization credentials and the beam proxy url
pub fn new(app: &AddressingId, key: &str, beam_proxy_url: Url) -> Self {
pub fn new(app: &AppId, key: &str, beam_proxy_url: Url) -> Self {
let default_headers = [
(header::AUTHORIZATION, HeaderValue::from_bytes(format!("ApiKey {app} {key}").as_bytes()).expect("This is a valid header value"))
].into_iter().collect();
Expand Down Expand Up @@ -187,13 +187,13 @@ impl BeamClient {
/// Create a socket task for some other application to connect to
/// For this to work both the beam proxy and beam broker need to have the sockets feature enabled.
#[cfg(feature = "sockets")]
pub async fn create_socket(&self, destination: &AddressingId) -> Result<reqwest::Upgraded> {
pub async fn create_socket(&self, destination: &AppId) -> Result<reqwest::Upgraded> {
self.create_socket_with_metadata(destination, serde_json::Value::Null).await
}

/// Same as `create_socket` but with associated (unencrypted) metadata.
#[cfg(feature = "sockets")]
pub async fn create_socket_with_metadata(&self, destination: &AddressingId, metadata: impl Serialize) -> Result<reqwest::Upgraded> {
pub async fn create_socket_with_metadata(&self, destination: &AppId, metadata: impl Serialize) -> Result<reqwest::Upgraded> {
const METADATA_HEADER: HeaderName = HeaderName::from_static("metadata");
let url = self.beam_proxy_url
.join(&format!("/v1/sockets/{destination}"))
Expand Down
Loading
Loading