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
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,12 @@ import { post_object } from '$lib/ae_api/api_post_object'; // Exported at the en
|
||||
import { get_ae_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_id';
|
||||
import { get_ae_obj_li_for_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_li_v1';
|
||||
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/ae_api/api_get__crud_obj_li_v2';
|
||||
import { get_ae_obj_v3, get_ae_obj_li_v3, get_nested_obj_li_v3 } from '$lib/ae_api/api_get__crud_obj_li_v3';
|
||||
import {
|
||||
get_ae_obj_v3,
|
||||
get_nested_ae_obj_v3,
|
||||
get_ae_obj_li_v3,
|
||||
get_nested_obj_li_v3
|
||||
} from '$lib/ae_api/api_get__crud_obj_li_v3';
|
||||
import { search_ae_obj_v3 } from '$lib/ae_api/api_post__crud_search_v3';
|
||||
|
||||
// This new function has not been tested yet!!!
|
||||
@@ -917,6 +922,7 @@ const obj = {
|
||||
post_object: post_object,
|
||||
get_ae_obj_id_crud: get_ae_obj_id_crud,
|
||||
get_ae_obj_v3: get_ae_obj_v3,
|
||||
get_nested_ae_obj_v3: get_nested_ae_obj_v3,
|
||||
get_ae_obj_li_for_obj_id_crud: get_ae_obj_li_for_obj_id_crud,
|
||||
get_ae_obj_li_for_obj_id_crud_v2: get_ae_obj_li_for_obj_id_crud_v2,
|
||||
get_ae_obj_li_v3: get_ae_obj_li_v3,
|
||||
|
||||
Reference in New Issue
Block a user