package api import ( "net/http" "atlas9.dev/c/core" "atlas9.dev/c/core/iam" ) func TenantsApi(mux *http.ServeMux, impl *TenantsImpl) { mux.HandleFunc("POST /Tenants.Create", impl.Create) mux.HandleFunc("POST /Tenants.Update", impl.Update) mux.HandleFunc("POST /Tenants.Get", impl.Get) mux.HandleFunc("POST /Tenants.Delete", impl.Delete) mux.HandleFunc("POST /Tenants.List", impl.List) } type Tenants_CreateReq struct { Tenant iam.Tenant } type Tenants_CreateRes struct { Tenant iam.Tenant } type Tenants_UpdateReq struct { Tenant iam.Tenant } type Tenants_UpdateRes struct { Tenant iam.Tenant } type Tenants_GetReq struct { ID core.ID } type Tenants_GetRes struct { Tenant iam.Tenant } type Tenants_DeleteReq struct { ID core.ID } type Tenants_DeleteRes struct{} type Tenants_ListReq struct { Page core.PageReq } type Tenants_ListRes struct { Page core.Page[iam.Tenant] } func (r *Tenants_CreateReq) Prepare() error { r.Tenant.ID = core.NewID("t") return r.Tenant.Validate() } func (r *Tenants_UpdateReq) Prepare() error { if r.Tenant.ID.IsEmpty() { return iam.ErrTenantIDEmpty } return r.Tenant.Validate() } func (r *Tenants_GetReq) Prepare() error { return nil } func (r *Tenants_DeleteReq) Prepare() error { return nil } func (r *Tenants_ListReq) Prepare() error { return nil }