Skip to content

Commit 87da910

Browse files
committed
feat: allow disabling other protocols while using a client
1 parent e07f897 commit 87da910

File tree

5 files changed

+183
-124
lines changed

5 files changed

+183
-124
lines changed

crates/sdk/Cargo.toml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,25 @@ client_native = [
5454
]
5555
# Internal feature used for common client features
5656
_client_common = [
57-
# Harmony protocols enabled
58-
"gen_chat",
5957
"gen_auth",
60-
"gen_mediaproxy",
61-
"gen_harmonytypes",
62-
"gen_batch",
63-
"gen_profile",
64-
"gen_emote",
65-
"rest",
6658
# Generate client code
6759
"gen_client",
6860
"reqwest",
6961
"tracing",
7062
"harmony_derive/client",
63+
"serde",
7164
]
7265
# Enable client backoff feature
7366
client_backoff = []
67+
# Enable recommended protocols that the client implements
68+
client_recommended = [
69+
"gen_chat",
70+
"gen_profile",
71+
"gen_emote",
72+
"gen_batch",
73+
"gen_mediaproxy",
74+
"rest",
75+
]
7476

7577
# Generate client code for communication with the network
7678
gen_client = ["hrpc/client", "harmony_build/client"]
@@ -88,10 +90,10 @@ gen_all_protocols = ["gen_stable_protocols", "gen_staging_protocols"]
8890

8991
## Stable protocols ##
9092
gen_chat = ["gen_harmonytypes", "gen_profile", "gen_emote"]
91-
gen_auth = []
93+
gen_auth = ["gen_harmonytypes"]
9294
gen_mediaproxy = ["gen_harmonytypes"]
9395
gen_harmonytypes = []
94-
gen_sync = []
96+
gen_sync = ["gen_harmonytypes"]
9597
gen_batch = []
9698
gen_profile = []
9799
gen_emote = []

crates/sdk/build.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ fn main() -> Result<()> {
4848
})
4949
};
5050

51-
let for_svcs = all_services
52-
.iter()
53-
.filter(|svc| matches!(**svc, "harmonytypes.v1" | "sync.v1").not());
51+
let for_svcs = all_services.iter().filter(|svc| {
52+
matches!(
53+
**svc,
54+
"harmonytypes.v1" | "sync.v1" | "voice.v1" | "bots.v1"
55+
)
56+
.not()
57+
});
5458

5559
for service in for_svcs {
5660
builder = add_impl_call_req(builder, service);

crates/sdk/src/api/profile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ pub use v1::*;
77

88
use std::fmt::{self, Display, Formatter};
99

10-
impl Into<Option<i32>> for UserStatus {
11-
fn into(self) -> Option<i32> {
12-
Some(self.into())
10+
impl From<UserStatus> for Option<i32> {
11+
fn from(status: UserStatus) -> Self {
12+
Some(status.into())
1313
}
1414
}
1515

0 commit comments

Comments
 (0)