apigee-x-module
Advanced tools
Comparing version 0.5.9 to 0.5.10
@@ -12,29 +12,31 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
auth.getClient().then((client) => { | ||
client.request({ | ||
url: `https://apigee.googleapis.com/v1/organizations/${client.projectId}/apiproducts?expand=true`, | ||
method: 'GET' | ||
}).then((response) => { | ||
let apigeeProducts = response.data; | ||
let products = { | ||
apiProducts: [] | ||
}; | ||
if (apigeeProducts && apigeeProducts.apiProduct) { | ||
apigeeProducts.apiProduct.forEach(apigeeProduct => { | ||
let apiProduct = apigeeProduct; | ||
if (apigeeProduct.attributes) | ||
for (const attr of apigeeProduct.attributes) { | ||
if (attr.name === "image") | ||
apiProduct.imageUrl = attr.value; | ||
if (attr.name === "spec") | ||
apiProduct.specUrl = attr.value; | ||
if (attr.name === "access") | ||
apiProduct.access = attr.value; | ||
} | ||
products.apiProducts.push(apiProduct); | ||
}); | ||
} | ||
resolve(products); | ||
}).catch((error) => { | ||
reject(error); | ||
auth.getProjectId().then((projectId) => { | ||
auth.getClient().then((client) => { | ||
client.request({ | ||
url: `https://apigee.googleapis.com/v1/organizations/${projectId}/apiproducts?expand=true`, | ||
method: 'GET' | ||
}).then((response) => { | ||
let apigeeProducts = response.data; | ||
let products = { | ||
apiProducts: [] | ||
}; | ||
if (apigeeProducts && apigeeProducts.apiProduct) { | ||
apigeeProducts.apiProduct.forEach(apigeeProduct => { | ||
let apiProduct = apigeeProduct; | ||
if (apigeeProduct.attributes) | ||
for (const attr of apigeeProduct.attributes) { | ||
if (attr.name === "image") | ||
apiProduct.imageUrl = attr.value; | ||
if (attr.name === "spec") | ||
apiProduct.specUrl = attr.value; | ||
if (attr.name === "access") | ||
apiProduct.access = attr.value; | ||
} | ||
products.apiProducts.push(apiProduct); | ||
}); | ||
} | ||
resolve(products); | ||
}).catch((error) => { | ||
reject(error); | ||
}); | ||
}); | ||
@@ -41,0 +43,0 @@ }); |
{ | ||
"name": "apigee-x-module", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"description": "Module for integrating with the Apigee X platform for TS/JS developer portal integrations.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/tyayers/apigee-x-module", |
40430
644