// Generated by openapi-moonbit — DO NOT EDIT
// Spec SHA-256: 7e574664c0f434e52021e12f313a3266fd3175fe2ecddde4c0e0930549c72ba2
///|
/// Operations in the `ApiDomain` group. Implement this trait to mock or wrap `Client`.
pub(open) trait ApiDomainClient {
async fn list_environment_domain_registrations(
self : Self,
environment_id~ : @uuid.UUID,
) -> @model.PageDomainRegistration raise GolemError
async fn create_domain_registration(
self : Self,
environment_id~ : @uuid.UUID,
body~ : @model.DomainRegistrationCreation,
) -> @model.DomainRegistration raise GolemError
async fn get_environment_domain_registration(
self : Self,
environment_id~ : @uuid.UUID,
domain~ : String,
) -> @model.DomainRegistration raise GolemError
async fn get_domain_registration(
self : Self,
domain_registration_id~ : @uuid.UUID,
) -> @model.DomainRegistration raise GolemError
async fn delete_domain_registration(
self : Self,
domain_registration_id~ : @uuid.UUID,
) -> Unit raise GolemError
}
///|
/// List all domain registrations in the environment
///
/// `GET /v1/envs/{environment_id}/domain-registrations` (`list_environment_domain_registrations`).
pub impl[T : @runtime.Transport] ApiDomainClient for Client[T] with fn list_environment_domain_registrations(
self : Client[T],
environment_id~ : @uuid.UUID,
) -> @model.PageDomainRegistration 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}/domain-registrations", __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.PageDomainRegistration)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Create a new domain registration in the environment
///
/// `POST /v1/envs/{environment_id}/domain-registrations` (`create_domain_registration`).
pub impl[T : @runtime.Transport] ApiDomainClient for Client[T] with fn create_domain_registration(
self : Client[T],
environment_id~ : @uuid.UUID,
body~ : @model.DomainRegistrationCreation,
) -> @model.DomainRegistration 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}/domain-registrations", __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.DomainRegistration)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Get a domain registration in an environment by domain.
///
/// `GET /v1/envs/{environment_id}/domain-registrations/{domain}` (`get_environment_domain_registration`).
pub impl[T : @runtime.Transport] ApiDomainClient for Client[T] with fn get_environment_domain_registration(
self : Client[T],
environment_id~ : @uuid.UUID,
domain~ : String,
) -> @model.DomainRegistration raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(("environment_id", environment_id.to_string()))
__path_params.push(("domain", domain))
let __path = self.expand_op_path(
"/v1/envs/{environment_id}/domain-registrations/{domain}", __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.DomainRegistration)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Get domain registration by id
///
/// `GET /v1/domain-registrations/{domain_registration_id}` (`get_domain_registration`).
pub impl[T : @runtime.Transport] ApiDomainClient for Client[T] with fn get_domain_registration(
self : Client[T],
domain_registration_id~ : @uuid.UUID,
) -> @model.DomainRegistration raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(
("domain_registration_id", domain_registration_id.to_string()),
)
let __path = self.expand_op_path(
"/v1/domain-registrations/{domain_registration_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.DomainRegistration)
})
_ => raise self.api_error_from_response(__resp)
}
}
///|
/// Delete domain registration
///
/// `DELETE /v1/domain-registrations/{domain_registration_id}` (`delete_domain_registration`).
pub impl[T : @runtime.Transport] ApiDomainClient for Client[T] with fn delete_domain_registration(
self : Client[T],
domain_registration_id~ : @uuid.UUID,
) -> Unit raise GolemError {
let __path_params : Array[(String, String)] = []
__path_params.push(
("domain_registration_id", domain_registration_id.to_string()),
)
let __path = self.expand_op_path(
"/v1/domain-registrations/{domain_registration_id}", __path_params,
)
let __req = self.prepare_request(http_method="DELETE", path=__path)
let __resp = self.send_request(__req)
match __resp.status() {
204 => ()
_ => raise self.api_error_from_response(__resp)
}
}
///|
pub extend Client with ApiDomainClient::{
list_environment_domain_registrations,
create_domain_registration,
get_environment_domain_registration,
get_domain_registration,
delete_domain_registration,
}