2727 process_get_response ,
2828)
2929from opendecree .errors import map_grpc_error
30- from opendecree .types import ServerVersion
30+ from opendecree .types import FieldUpdate , ServerVersion
3131
3232
3333class AsyncConfigClient :
@@ -233,6 +233,9 @@ async def set(
233233 field_path : str ,
234234 value : str ,
235235 * ,
236+ description : str | None = None ,
237+ value_description : str | None = None ,
238+ expected_checksum : str | None = None ,
236239 idempotency_key : str | None = None ,
237240 ) -> None :
238241 """Set a config value.
@@ -244,6 +247,10 @@ async def set(
244247 tenant_id: Tenant UUID.
245248 field_path: Dot-separated field path (e.g., ``"payments.fee"``).
246249 value: The value as a string.
250+ description: Optional version-level description for the audit log.
251+ value_description: Optional description stored with this specific value.
252+ expected_checksum: When set, the server rejects the write if the
253+ current value's checksum does not match (optimistic concurrency).
247254 idempotency_key: When provided, the request is retried on
248255 ``DEADLINE_EXCEEDED`` in addition to ``UNAVAILABLE``. Use only
249256 when the write is safe to apply more than once (e.g., the value
@@ -255,6 +262,7 @@ async def set(
255262 NotFoundError: If the field does not exist in the schema.
256263 LockedError: If the field is locked.
257264 InvalidArgumentError: If the value fails validation.
265+ ChecksumMismatchError: If ``expected_checksum`` is set and does not match.
258266 """
259267 retry_cfg = self ._retry if idempotency_key is not None else write_safe_config (self ._retry )
260268
@@ -264,6 +272,9 @@ async def _call() -> None:
264272 tenant_id = tenant_id ,
265273 field_path = field_path ,
266274 value = make_string_typed_value (value ),
275+ description = description ,
276+ value_description = value_description ,
277+ expected_checksum = expected_checksum ,
267278 ),
268279 timeout = self ._timeout ,
269280 metadata = self ._metadata (),
@@ -277,17 +288,18 @@ async def _call() -> None:
277288 async def set_many (
278289 self ,
279290 tenant_id : str ,
280- values : dict [ str , str ],
291+ updates : list [ FieldUpdate ],
281292 * ,
282- description : str = "" ,
293+ description : str | None = None ,
283294 idempotency_key : str | None = None ,
284295 ) -> None :
285296 """Atomically set multiple config values.
286297
287298 Args:
288299 tenant_id: Tenant UUID.
289- values: Dict mapping field paths to string values.
290- description: Optional description for the audit log.
300+ updates: List of :class:`FieldUpdate` objects, each carrying a
301+ field path, value, and optional per-field metadata.
302+ description: Optional version-level description for the audit log.
291303 idempotency_key: When provided, the request is retried on
292304 ``DEADLINE_EXCEEDED`` in addition to ``UNAVAILABLE``. See
293305 ``set()`` for details on retry semantics.
@@ -296,21 +308,24 @@ async def set_many(
296308 NotFoundError: If a field does not exist in the schema.
297309 LockedError: If any field is locked.
298310 InvalidArgumentError: If any value fails validation.
311+ ChecksumMismatchError: If any ``expected_checksum`` does not match.
299312 """
300313 retry_cfg = self ._retry if idempotency_key is not None else write_safe_config (self ._retry )
301314
302315 async def _call () -> None :
303- updates = [
316+ proto_updates = [
304317 self ._pb2 .FieldUpdate (
305- field_path = fp ,
306- value = make_string_typed_value (v ),
318+ field_path = u .field_path ,
319+ value = make_string_typed_value (u .value ),
320+ expected_checksum = u .expected_checksum ,
321+ value_description = u .value_description ,
307322 )
308- for fp , v in values . items ()
323+ for u in updates
309324 ]
310325 await self ._stub .SetFields (
311326 self ._pb2 .SetFieldsRequest (
312327 tenant_id = tenant_id ,
313- updates = updates ,
328+ updates = proto_updates ,
314329 description = description ,
315330 ),
316331 timeout = self ._timeout ,
0 commit comments