mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 08:27:53 +00:00
create windmill get all workspaces list function
This commit is contained in:
@@ -32,6 +32,8 @@ import {
|
|||||||
INTEGRATION_TRAVISCI_API_URL,
|
INTEGRATION_TRAVISCI_API_URL,
|
||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
INTEGRATION_VERCEL_API_URL,
|
INTEGRATION_VERCEL_API_URL,
|
||||||
|
INTEGRATION_WINDMILL,
|
||||||
|
INTEGRATION_WINDMILL_API_URL,
|
||||||
} from "../variables";
|
} from "../variables";
|
||||||
|
|
||||||
interface App {
|
interface App {
|
||||||
@@ -145,6 +147,11 @@ const getApps = async ({
|
|||||||
accountId: accessId
|
accountId: accessId
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
|
case INTEGRATION_WINDMILL:
|
||||||
|
apps = await getAppsWindmill({
|
||||||
|
accessToken,
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
@@ -721,4 +728,33 @@ const getAppsCloudflarePages = async ({
|
|||||||
return apps;
|
return apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of projects for Windmill integration
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {String} obj.accessToken - access token for Windmill API
|
||||||
|
* @returns {Object[]} apps - names of Windmill workspaces
|
||||||
|
* @returns {String} apps.name - name of Windmill workspace
|
||||||
|
*/
|
||||||
|
const getAppsWindmill = async ({ accessToken }: { accessToken: string }) => {
|
||||||
|
const { data } = await standardRequest.get(
|
||||||
|
`${INTEGRATION_WINDMILL_API_URL}/workspaces/list`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${accessToken}`,
|
||||||
|
"Accept-Encoding": "application/json",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const apps = data.map((a: any) => {
|
||||||
|
return {
|
||||||
|
name: a.name,
|
||||||
|
appId: a.id,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return apps;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export { getApps };
|
export { getApps };
|
||||||
|
|||||||
Reference in New Issue
Block a user