mirror of
https://github.com/LukeHagar/api-specs.git
synced 2025-12-07 20:37:44 +00:00
fixed script to fail on upload failure
This commit is contained in:
@@ -114,6 +114,17 @@ async function uploadCollection() {
|
||||
async function main() {
|
||||
try {
|
||||
const response = await getCollections();
|
||||
if (!response.collections) {
|
||||
console.log(response)
|
||||
throw new Error("Postman API threw an error");
|
||||
}
|
||||
const upload = await uploadCollection();
|
||||
if (!upload.collection) {
|
||||
console.log(upload)
|
||||
throw new Error("Postman API threw an error");
|
||||
}
|
||||
console.log(upload);
|
||||
fs.writeFileSync('postman/links/' + args[3].toLowerCase() + '-link.txt','https://god.gw.postman.com/run-collection/' + upload.collection.uid + '?action=collection%2Ffork&collection-url=entityId%3D' + upload.collection.uid + '%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0')
|
||||
for (let collection of response.collections) {
|
||||
if (collection.name.includes(args[3])) {
|
||||
console.log(collection);
|
||||
@@ -121,9 +132,6 @@ async function main() {
|
||||
console.log(response);
|
||||
}
|
||||
}
|
||||
const upload = await uploadCollection();
|
||||
console.log(upload);
|
||||
fs.writeFileSync('postman/links/' + args[3].toLowerCase() + '-link.txt','https://god.gw.postman.com/run-collection/' + upload.collection.uid + '?action=collection%2Ffork&collection-url=entityId%3D' + upload.collection.uid + '%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0')
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
https://god.gw.postman.com/run-collection/23226990-6666a82e-d785-4fa0-b9f8-c1a3a63533e9?action=collection%2Ffork&collection-url=entityId%3D23226990-6666a82e-d785-4fa0-b9f8-c1a3a63533e9%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0
|
||||
https://god.gw.postman.com/run-collection/23226990-0f1c5334-ce2e-4b32-b516-cff77c38097f?action=collection%2Ffork&collection-url=entityId%3D23226990-0f1c5334-ce2e-4b32-b516-cff77c38097f%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0
|
||||
Reference in New Issue
Block a user