How to query linked DocTypes from JS

I’m writing custom HTML and JS for an ERPNext “page”.

I need to write a frappe.call() that will tell me how many “address” records are present for a given “customer”.

For example: Company A has a “primary address” and “primary contact”. However, it also has another address it prefers for
shipping. When viewing the Company A record, both addresses are shown.

Thus I need to write a frappe.call() that will return both the primary address and shipping address for Company A.

I’m currently using the frappe.client.get_list server method as follows:

function queryTest() {
    frappe.call({
        method: 'frappe.client.get_list',
        args: {
            doctype: 'Customer',
            fields: [
                // I need a field or fields that will allow me to query the Address doctype I think??
            ],
            filters: {
                name: 'Customer Name'
            }
        },
        callback: function(r) {
            frappe.call({
                method: 'frappe.client.get_list',
                args: {
                    doctype: 'Address',
                    fields: [
                        'address_line1',
                        'address_line2',
                        'city',
                        'state',
                        'pincode'
                    ],
                    filters: {
                        // How do I use the field(s) from the first call to filter on the second call?  Or do I?
                    }
                }
            });
        }
    });
}

Figured out that I need to query the Dynamic Link doctype.

However, when I do that, it says I don’t have permission to access the “parent” field.

function queryTest() {
    frappe.call({
        method: 'frappe.client.get_list',
        args: {
            doctype: 'Dynamic Link',
            fields: [
                'parent'
            ],
            filters: {
                link_title: 'Dev Alpha'
            }
        },
        callback: function(r) {
            console.log(r.message.parent);
        }
    });
}

Ended up writing a python script to execute server side, problem solved.