@@ -8,9 +8,8 @@ use temporalio_client::tonic::{
88 metadata:: { AsciiMetadataKey , AsciiMetadataValue , BinaryMetadataKey , BinaryMetadataValue } ,
99} ;
1010use temporalio_client:: {
11- ClientKeepAliveConfig as CoreClientKeepAliveConfig , ClientOptions , ClientOptionsBuilder ,
12- ConfiguredClient , HttpConnectProxyOptions , RetryClient , RetryConfig , TemporalServiceClient ,
13- TlsConfig ,
11+ ClientKeepAliveOptions as CoreClientKeepAliveConfig , ClientOptions , ConfiguredClient ,
12+ HttpConnectProxyOptions , RetryClient , RetryOptions , TemporalServiceClient ,
1413} ;
1514use url:: Url ;
1615
@@ -229,47 +228,44 @@ impl TryFrom<ClientConfig> for ClientOptions {
229228 type Error = PyErr ;
230229
231230 fn try_from ( opts : ClientConfig ) -> PyResult < Self > {
232- let mut gateway_opts = ClientOptionsBuilder :: default ( ) ;
233231 let ( ascii_headers, binary_headers) = partition_headers ( opts. metadata ) ;
234- gateway_opts
232+ let gateway_opts = ClientOptions :: builder ( )
235233 . target_url (
236234 Url :: parse ( & opts. target_url )
237235 . map_err ( |err| PyValueError :: new_err ( format ! ( "invalid target URL: {err}" ) ) ) ?,
238236 )
239237 . client_name ( opts. client_name )
240238 . client_version ( opts. client_version )
241239 . identity ( opts. identity )
242- . retry_config (
240+ . retry_options (
243241 opts. retry_config
244- . map_or ( RetryConfig :: default ( ) , |c| c. into ( ) ) ,
242+ . map_or ( RetryOptions :: default ( ) , |c| c. into ( ) ) ,
245243 )
246244 . keep_alive ( opts. keep_alive_config . map ( Into :: into) )
247- . http_connect_proxy ( opts. http_connect_proxy_config . map ( Into :: into) )
248- . headers ( Some ( ascii_headers) )
249- . binary_headers ( Some ( binary_headers) )
250- . api_key ( opts. api_key ) ;
251- // Builder does not allow us to set option here, so we have to make
252- // a conditional to even call it
253- if let Some ( tls_config) = opts. tls_config {
254- gateway_opts. tls_cfg ( tls_config. try_into ( ) ?) ;
255- }
256- gateway_opts
257- . build ( )
258- . map_err ( |err| PyValueError :: new_err ( format ! ( "Invalid client config: {err}" ) ) )
245+ . maybe_http_connect_proxy ( opts. http_connect_proxy_config . map ( Into :: into) )
246+ . headers ( ascii_headers)
247+ . binary_headers ( binary_headers)
248+ . maybe_api_key ( opts. api_key )
249+ . maybe_tls_options ( if let Some ( tls_config) = opts. tls_config {
250+ Some ( tls_config. try_into ( ) ?)
251+ } else {
252+ None
253+ } ) ;
254+ Ok ( gateway_opts. build ( ) )
259255 }
260256}
261257
262- impl TryFrom < ClientTlsConfig > for temporalio_client:: TlsConfig {
258+ impl TryFrom < ClientTlsConfig > for temporalio_client:: TlsOptions {
263259 type Error = PyErr ;
264260
265261 fn try_from ( conf : ClientTlsConfig ) -> PyResult < Self > {
266- Ok ( TlsConfig {
262+ Ok ( temporalio_client :: TlsOptions {
267263 server_root_ca_cert : conf. server_root_ca_cert ,
268264 domain : conf. domain ,
269- client_tls_config : match ( conf. client_cert , conf. client_private_key ) {
265+ client_tls_options : match ( conf. client_cert , conf. client_private_key ) {
270266 ( None , None ) => None ,
271267 ( Some ( client_cert) , Some ( client_private_key) ) => {
272- Some ( temporalio_client:: ClientTlsConfig {
268+ Some ( temporalio_client:: ClientTlsOptions {
273269 client_cert,
274270 client_private_key,
275271 } )
@@ -284,9 +280,9 @@ impl TryFrom<ClientTlsConfig> for temporalio_client::TlsConfig {
284280 }
285281}
286282
287- impl From < ClientRetryConfig > for RetryConfig {
283+ impl From < ClientRetryConfig > for RetryOptions {
288284 fn from ( conf : ClientRetryConfig ) -> Self {
289- RetryConfig {
285+ RetryOptions {
290286 initial_interval : Duration :: from_millis ( conf. initial_interval_millis ) ,
291287 randomization_factor : conf. randomization_factor ,
292288 multiplier : conf. multiplier ,
0 commit comments