32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
async function main() {
|
|
const authRes = await fetch('https://auth.ghaymah.systems/signin/email-password', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ email: 'ziadalex2003@gmail.com', password: '2062003Mz*' })
|
|
});
|
|
const { session } = await authRes.json();
|
|
const token = session.accessToken;
|
|
const userId = session.user.id;
|
|
|
|
const res = await fetch('https://graphql.ghaymah.systems/v1/graphql', {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
query: `query GetResources($userId: uuid) {
|
|
ghaymah_cloud_resources(where: { user_id: { _eq: $userId }, deleted: { _eq: false }, chart_name: { _eq: "ghaymah-app" } }) {
|
|
id chart_name status values message
|
|
}
|
|
}`,
|
|
variables: { userId }
|
|
})
|
|
});
|
|
const data = await res.json();
|
|
data.data.ghaymah_cloud_resources.forEach(r => {
|
|
console.log('App:', r.values.name, '| Domain:', r.values.publicAccess?.domain, '| Status:', r.status);
|
|
console.log(' Ports:', JSON.stringify(r.values.ports));
|
|
console.log(' Image:', r.values.container?.image);
|
|
console.log(' Project:', r.values.projectId);
|
|
});
|
|
}
|
|
main().catch(console.error);
|