Now with a working V# GET ID and GET nested ID.

This commit is contained in:
Scott Idem
2026-01-05 18:52:11 -05:00
parent bb6b3b7352
commit 45f7393ee3
3 changed files with 111 additions and 135 deletions

View File

@@ -6,6 +6,8 @@ interface GetAeObjV3Params {
obj_type: string;
obj_id: string;
view?: string;
params?: key_val;
headers?: key_val;
log_lvl?: number;
}
@@ -17,21 +19,68 @@ export async function get_ae_obj_v3({
obj_type,
obj_id,
view = 'default',
params = {},
headers = {},
log_lvl = 0
}: GetAeObjV3Params) {
const endpoint = `/v3/crud/${obj_type}/${obj_id}`;
const params: key_val = { view };
const query_params: key_val = { view, ...params };
if (log_lvl) {
console.log('*** get_ae_obj_v3 ***');
console.log('Endpoint:', endpoint);
console.log('Params:', params);
console.log('Params:', query_params);
}
return await get_object({
api_cfg,
endpoint,
params,
params: query_params,
headers,
log_lvl
});
}
interface GetNestedAeObjV3Params {
api_cfg: any;
parent_type: string;
parent_id: string;
child_type: string;
child_id: string;
view?: string;
params?: key_val;
headers?: key_val;
log_lvl?: number;
}
/**
* Get a single nested object by ID (V3)
*/
export async function get_nested_ae_obj_v3({
api_cfg,
parent_type,
parent_id,
child_type,
child_id,
view = 'default',
params = {},
headers = {},
log_lvl = 0
}: GetNestedAeObjV3Params) {
const endpoint = `/v3/crud/${parent_type}/${parent_id}/${child_type}/${child_id}`;
const query_params: key_val = { view, ...params };
if (log_lvl) {
console.log('*** get_nested_ae_obj_v3 ***');
console.log('Endpoint:', endpoint);
console.log('Params:', query_params);
}
return await get_object({
api_cfg,
endpoint,
params: query_params,
headers,
log_lvl
});
}