apigee-x-module
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -183,20 +183,3 @@ "use strict"; | ||
apigeeApps.app.forEach(apigeeApp => { | ||
let app = { | ||
appId: apigeeApp.appId, | ||
name: apigeeApp.name, | ||
createdAt: apigeeApp.createdAt, | ||
credentials: [], | ||
apiProducts: apigeeApp.apiProducts | ||
}; | ||
apigeeApp.credentials.forEach((apigeeCredential) => { | ||
let appCredential = { | ||
key: apigeeCredential.consumerKey, | ||
secret: apigeeCredential.consumerSecret, | ||
issuedAt: apigeeCredential.issuedAt, | ||
expiresAt: apigeeCredential.expiresAt, | ||
scopes: apigeeCredential.scopes, | ||
status: apigeeCredential.status | ||
}; | ||
app.credentials.push(appCredential); | ||
}); | ||
let app = apigeeApp; | ||
apps.apps.push(app); | ||
@@ -234,20 +217,3 @@ }); | ||
let apigeeApp = response.data; | ||
let app = { | ||
appId: apigeeApp.appId, | ||
name: apigeeApp.name, | ||
createdAt: apigeeApp.createdAt, | ||
credentials: [], | ||
apiProducts: apigeeApp.apiProducts | ||
}; | ||
apigeeApp.credentials.forEach((apigeeCredential) => { | ||
let appCredential = { | ||
key: apigeeCredential.consumerKey, | ||
secret: apigeeCredential.consumerSecret, | ||
issuedAt: apigeeCredential.issuedAt, | ||
expiresAt: apigeeCredential.expiresAt, | ||
scopes: apigeeCredential.scopes, | ||
status: apigeeCredential.status | ||
}; | ||
app.credentials.push(appCredential); | ||
}); | ||
let app = apigeeApp; | ||
resolve(app); | ||
@@ -278,20 +244,3 @@ }).catch((error) => { | ||
let apigeeApp = response.data; | ||
let app = { | ||
appId: apigeeApp.appId, | ||
name: apigeeApp.name, | ||
createdAt: apigeeApp.createdAt, | ||
credentials: [], | ||
apiProducts: apigeeApp.apiProducts | ||
}; | ||
apigeeApp.credentials.forEach((apigeeCredential) => { | ||
let appCredential = { | ||
key: apigeeCredential.consumerKey, | ||
secret: apigeeCredential.consumerSecret, | ||
issuedAt: apigeeCredential.issuedAt, | ||
expiresAt: apigeeCredential.expiresAt, | ||
scopes: apigeeCredential.scopes, | ||
status: apigeeCredential.status | ||
}; | ||
app.credentials.push(appCredential); | ||
}); | ||
let app = apigeeApp; | ||
resolve(app); | ||
@@ -311,6 +260,53 @@ }).catch((error) => { | ||
updateApp(email, appName, app) { | ||
throw new Error("Method not implemented."); | ||
return new Promise((resolve, reject) => { | ||
this.getToken().then((token) => { | ||
axios({ | ||
"url": `https://apigee.googleapis.com/v1/organizations/${this.apigeeOrganization}/developers/${email}/apps/${appName}`, | ||
"method": "put", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Authorization": "Bearer " + token | ||
}, | ||
"data": app | ||
}).then((response) => { | ||
let apigeeApp = response.data; | ||
let app = apigeeApp; | ||
resolve(app); | ||
}).catch((error) => { | ||
if (error.response && error.response.data) | ||
resolve(error.response.data); | ||
else | ||
reject(error); | ||
}); | ||
}).catch((error) => { | ||
console.error(error); | ||
reject(error); | ||
}); | ||
}); | ||
} | ||
deleteApp(email, appName) { | ||
throw new Error("Method not implemented."); | ||
return new Promise((resolve, reject) => { | ||
this.getToken().then((token) => { | ||
axios({ | ||
"url": `https://apigee.googleapis.com/v1/organizations/${this.apigeeOrganization}/developers/${email}/apps/${appName}`, | ||
"method": "delete", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Authorization": "Bearer " + token | ||
} | ||
}).then((response) => { | ||
let apigeeApp = response.data; | ||
let app = apigeeApp; | ||
resolve(app); | ||
}).catch((error) => { | ||
if (error.response && error.response.data) | ||
resolve(error.response.data); | ||
else | ||
reject(error); | ||
}); | ||
}).catch((error) => { | ||
console.error(error); | ||
reject(error); | ||
}); | ||
}); | ||
} | ||
@@ -317,0 +313,0 @@ getToken() { |
@@ -35,2 +35,3 @@ interface ApigeeApiProducts { | ||
apiproduct: string; | ||
status: string; | ||
} | ||
@@ -100,3 +101,3 @@ interface ApigeeDevelopers { | ||
callbackUrl?: string; | ||
apiProducts: string[]; | ||
apiProducts?: string[]; | ||
status?: string; | ||
@@ -107,9 +108,14 @@ credentials?: AppCredential[]; | ||
interface AppCredential { | ||
key: string; | ||
secret: string; | ||
consumerKey: string; | ||
consumerSecret: string; | ||
issuedAt: string; | ||
expiresAt: string; | ||
scopes?: string[]; | ||
apiProducts?: AppCredentialProduct[]; | ||
status?: string; | ||
} | ||
export { ApigeeApiProducts, ApiProducts, ApiProduct, ApigeeDevelopers, ApigeeDeveloper, ApigeeApps, ApigeeApp, ApigeeAppCredential, Developers, Developer, Apps, App, AppCredential }; | ||
interface AppCredentialProduct { | ||
apiproduct: string; | ||
status: string; | ||
} | ||
export { ApigeeApiProducts, ApigeeApiProduct, ApiProducts, ApiProduct, ApigeeDevelopers, ApigeeDeveloper, ApigeeApps, ApigeeApp, ApigeeAppCredential, Developers, Developer, Apps, App, AppCredential }; |
{ | ||
"name": "apigee-x-module", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"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", |
13
509
32893