// Generated by openapi-moonbit — DO NOT EDIT
// Spec SHA-256: 7e574664c0f434e52021e12f313a3266fd3175fe2ecddde4c0e0930549c72ba2
///|
/// Operations in the `RetryPolicies` group. Implement this trait to mock or wrap `Client`.
pub(open) trait RetryPoliciesClient {
async fn list_environment_retry_policies(
self : Self,
environment_id~ : @uuid.UUID,
) -> @model.PageRetryPolicyDto raise GolemError
async fn create_retry_policy(
self : Self,
environment_id~ : @uuid.UUID,
body~ : @model.RetryPolicyCreation,
) -> @model.RetryPolicyDto raise GolemError
async fn get_environment_retry_policy(
self : Self,
environment_id~ : @uuid.UUID,
retry_policy_name~ : String,
) -> @model.RetryPolicyDto raise GolemError
async fn get_retry_policy(self : Self, retry_policy_id~ : @uuid.UUID) -> @model.RetryPolicyDto raise GolemError
async fn delete_retry_policy(
self : Self,
retry_policy_id~ : @uuid.UUID,
current_revision~ : UInt64,
) -> @model.RetryPolicyDto raise GolemError
async fn update_retry_policy(
self : Self,
retry_policy_id~ : @uuid.UUID,
body~ : @model.RetryPolicyUpdate,
) -> @model.RetryPolicyDto raise GolemError
}
///|
/// Get all retry policies of the environment
///
/// `GET /v1/envs/{environment_id}/retry-policies` (`list_environment_retry_policies`).
pub impl[T : @runtime.Transport] RetryPoliciesClient for Client[T] with fn list_environment_retry_policies(
self : Client[T],
environment_id~ : @uuid.UUID,
) -> @model.PageRetryPolicyDto raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(("environment_id", environment_id.to_string()))
let __path = self.expand_op_path(
"/v1/envs/{environment_id}/retry-policies", __path_params,
)
let __req = self.prepare_request(http_method="GET", path=__path)
let __resp = self.send_request(__req)
match __resp.status() {
200 =>
self.decode_json_response(__resp, __r => {
(
@cjson.FromJson::from_json(__r.raw(), __r.context()) :
@model.PageRetryPolicyDto)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Create a new retry policy
///
/// `POST /v1/envs/{environment_id}/retry-policies` (`create_retry_policy`).
pub impl[T : @runtime.Transport] RetryPoliciesClient for Client[T] with fn create_retry_policy(
self : Client[T],
environment_id~ : @uuid.UUID,
body~ : @model.RetryPolicyCreation,
) -> @model.RetryPolicyDto raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(("environment_id", environment_id.to_string()))
let __path = self.expand_op_path(
"/v1/envs/{environment_id}/retry-policies", __path_params,
)
let __req = self.prepare_request(http_method="POST", path=__path)
let _ = __req.with_body(
content_type="application/json",
body=@runtime.utf8_encode(body.to_json().stringify()),
)
let __resp = self.send_request(__req)
match __resp.status() {
200 =>
self.decode_json_response(__resp, __r => {
(
@cjson.FromJson::from_json(__r.raw(), __r.context()) :
@model.RetryPolicyDto)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Get a retry policy in an environment by name.
///
/// `GET /v1/envs/{environment_id}/retry-policies/{retry_policy_name}` (`get_environment_retry_policy`).
pub impl[T : @runtime.Transport] RetryPoliciesClient for Client[T] with fn get_environment_retry_policy(
self : Client[T],
environment_id~ : @uuid.UUID,
retry_policy_name~ : String,
) -> @model.RetryPolicyDto raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(("environment_id", environment_id.to_string()))
__path_params.push(("retry_policy_name", retry_policy_name))
let __path = self.expand_op_path(
"/v1/envs/{environment_id}/retry-policies/{retry_policy_name}", __path_params,
)
let __req = self.prepare_request(http_method="GET", path=__path)
let __resp = self.send_request(__req)
match __resp.status() {
200 =>
self.decode_json_response(__resp, __r => {
(
@cjson.FromJson::from_json(__r.raw(), __r.context()) :
@model.RetryPolicyDto)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Get retry policy by id.
///
/// `GET /v1/retry-policies/{retry_policy_id}` (`get_retry_policy`).
pub impl[T : @runtime.Transport] RetryPoliciesClient for Client[T] with fn get_retry_policy(
self : Client[T],
retry_policy_id~ : @uuid.UUID,
) -> @model.RetryPolicyDto raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(("retry_policy_id", retry_policy_id.to_string()))
let __path = self.expand_op_path(
"/v1/retry-policies/{retry_policy_id}", __path_params,
)
let __req = self.prepare_request(http_method="GET", path=__path)
let __resp = self.send_request(__req)
match __resp.status() {
200 =>
self.decode_json_response(__resp, __r => {
(
@cjson.FromJson::from_json(__r.raw(), __r.context()) :
@model.RetryPolicyDto)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Delete retry policy
///
/// `DELETE /v1/retry-policies/{retry_policy_id}` (`delete_retry_policy`).
pub impl[T : @runtime.Transport] RetryPoliciesClient for Client[T] with fn delete_retry_policy(
self : Client[T],
retry_policy_id~ : @uuid.UUID,
current_revision~ : UInt64,
) -> @model.RetryPolicyDto raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(("retry_policy_id", retry_policy_id.to_string()))
let __path = self.expand_op_path(
"/v1/retry-policies/{retry_policy_id}", __path_params,
)
let __qb = @encoding.QueryBuilder::new()
let _ = __qb.add_scalar(
"current_revision",
@encoding.format_uint64(current_revision),
)
let __req = self.prepare_request(
http_method="DELETE",
path=__path,
query=__qb.build(),
)
let __resp = self.send_request(__req)
match __resp.status() {
200 =>
self.decode_json_response(__resp, __r => {
(
@cjson.FromJson::from_json(__r.raw(), __r.context()) :
@model.RetryPolicyDto)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Update retry policy
///
/// `PATCH /v1/retry-policies/{retry_policy_id}` (`update_retry_policy`).
pub impl[T : @runtime.Transport] RetryPoliciesClient for Client[T] with fn update_retry_policy(
self : Client[T],
retry_policy_id~ : @uuid.UUID,
body~ : @model.RetryPolicyUpdate,
) -> @model.RetryPolicyDto raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(("retry_policy_id", retry_policy_id.to_string()))
let __path = self.expand_op_path(
"/v1/retry-policies/{retry_policy_id}", __path_params,
)
let __req = self.prepare_request(http_method="PATCH", path=__path)
let _ = __req.with_body(
content_type="application/json",
body=@runtime.utf8_encode(body.to_json().stringify()),
)
let __resp = self.send_request(__req)
match __resp.status() {
200 =>
self.decode_json_response(__resp, __r => {
(
@cjson.FromJson::from_json(__r.raw(), __r.context()) :
@model.RetryPolicyDto)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
pub extend Client with RetryPoliciesClient::{
list_environment_retry_policies,
create_retry_policy,
get_environment_retry_policy,
get_retry_policy,
delete_retry_policy,
update_retry_policy,
}