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

feat: Return reconfigured stream #95

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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 proto
Submodule proto updated 1 files
+4 −1 s2/v1alpha/s2.proto
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ impl BasinClient {
pub async fn reconfigure_stream(
&self,
req: types::ReconfigureStreamRequest,
) -> Result<(), ClientError> {
) -> Result<types::StreamConfig, ClientError> {
self.inner
.send(ReconfigureStreamServiceRequest::new(
self.inner.basin_service_client(),
Expand Down
6 changes: 3 additions & 3 deletions src/service/basin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl ReconfigureStreamServiceRequest {

impl ServiceRequest for ReconfigureStreamServiceRequest {
type ApiRequest = api::ReconfigureStreamRequest;
type Response = ();
type Response = types::StreamConfig;
type ApiResponse = api::ReconfigureStreamResponse;
const IDEMPOTENCY_LEVEL: IdempotencyLevel = IdempotencyLevel::IdempotencyUnknown;

Expand All @@ -208,8 +208,8 @@ impl ServiceRequest for ReconfigureStreamServiceRequest {

fn parse_response(
&self,
_resp: tonic::Response<Self::ApiResponse>,
resp: tonic::Response<Self::ApiResponse>,
) -> Result<Self::Response, types::ConvertError> {
Ok(())
resp.into_inner().try_into()
}
}
17 changes: 13 additions & 4 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,15 @@ impl From<ReconfigureBasinRequest> for api::ReconfigureBasinRequest {
}
}

impl TryFrom<api::ReconfigureBasinResponse> for BasinConfig {
type Error = ConvertError;
fn try_from(value: api::ReconfigureBasinResponse) -> Result<Self, Self::Error> {
let api::ReconfigureBasinResponse { config } = value;
let config = config.ok_or("missing basin config")?;
config.try_into()
}
}

#[sync_docs]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -744,11 +753,11 @@ impl From<ReconfigureStreamRequest> for api::ReconfigureStreamRequest {
}
}

impl TryFrom<api::ReconfigureBasinResponse> for BasinConfig {
impl TryFrom<api::ReconfigureStreamResponse> for StreamConfig {
type Error = ConvertError;
fn try_from(value: api::ReconfigureBasinResponse) -> Result<Self, Self::Error> {
let api::ReconfigureBasinResponse { config } = value;
let config = config.ok_or("missing basin config")?;
fn try_from(value: api::ReconfigureStreamResponse) -> Result<Self, Self::Error> {
let api::ReconfigureStreamResponse { config } = value;
let config = config.ok_or("missing stream config")?;
config.try_into()
}
}
Expand Down
Loading