"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFunctionUrl = getFunctionUrl; const google_auth_library_1 = require("google-auth-library"); /** * Get the URL of a given v2 cloud function. * * @param {string} name the function's name * @param {string} location the function's location * @return {Promise} The URL of the function */ async function getFunctionUrl(name, location = "us-central1") { const projectId = `reader-6b7dc`; const url = "https://cloudfunctions.googleapis.com/v2beta/" + `projects/${projectId}/locations/${location}/functions/${name}`; const auth = new google_auth_library_1.GoogleAuth({ scopes: 'https://www.googleapis.com/auth/cloud-platform', }); const client = await auth.getClient(); const res = await client.request({ url }); const uri = res.data?.serviceConfig?.uri; if (!uri) { throw new Error(`Unable to retreive uri for function at ${url}`); } return uri; } //# sourceMappingURL=get-function-url.js.map