Now with a working V# GET ID and GET nested ID.
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user